GoForum🌐 V2EX

OpenClaw 如何配置中转 api 的画图模型?

ethusdt · 2026-02-06 10:52 · 0 次点赞 · 0 条回复

中转 api 经过测试可以正常画图,并且返回的内容是 base64 图片 :

    {
      "role": "assistant",
      "content": "![image](data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEBLAEsAAD/6xgKSlAAAQAAAAEAABgAanVXv10S20tpbV2Wqv5//Z)",
      "createAt": 1770184552571,
      "id": "5",
      "reasoningContent": "**Outlining the Infographic**\n\nI've outlined the infographic's content, focusing on the embedding model and RAG system.xxxx.\n\n\n",
      "isReasoningExpanded": false,
      "isThinkingComplete": true,
      "hasAutoCollapsed": true,
      "status": "complete"
    }

我配置在 openclaw 中:

     "xyz": {
        "baseUrl": "https://api.example.com",
        "apiKey": "sk-xxx",
        "api": "google-generative-ai",
        "models": [
          {
            "id": "gemini-3-pro-image-preview",
            "name": "gemini-image",
            "reasoning": false,
            "input": [
              "text"
            ],
            "cost": {
              "input": 0,
              "output": 0,
              "cacheRead": 0,
              "cacheWrite": 0
            },
            "contextWindow": 200000,
            "maxTokens": 64000
          }
        ]
      }
    }

并且配置了这个 agent:

      {
        "id": "image-agent",
        "name": "image creator",
        "workspace": "/root/.openclaw/workspaces/image-agent",
        "model": {
          "primary": "xyz/gemini-3-pro-image-preview"
        }
      }

但是我在 tg 让其作图时候报错: Incomplete JSON segment at the end

应该是无法解析 base64 的 content 。

让主 agent 解决,它也没太有办法:

有两个选择:

1. 临时方案:给画师 agent 写个 system prompt
让它用工具把 base64 保存成文件,然后用 message 工具发送图片。但这比较 hacky 。

2. 正确方案:向 OpenClaw 提 issue/PR
让 OpenClaw 支持解析模型响应中的 markdown base64 图片,自动提取并作为附件发送。

但我看很多人配置作图都是正常的,应该是直接支持的。

0 条回复
添加回复
你还需要 登录 后发表回复

登录后可发帖和回复

登录 注册
主题信息
作者: ethusdt
发布: 2026-02-06
点赞: 0
回复: 0