V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
ethusdt
0.01D
V2EX  ›  OpenClaw

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

  •  
  •   ethusdt · 6 天前 · 394 次点击

    中转 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 图片,自动提取并作为附件发送。
    

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

    1 条回复    2026-02-06 18:43:10 +08:00
    linbenyi
        1
    linbenyi  
    PRO
       6 天前
    或许有流式输出可关闭?
    stream: false
    这个样的?
    关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   1458 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 16:25 · PVG 00:25 · LAX 08:25 · JFK 11:25
    ♥ Do have faith in what you're doing.