V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
ethusdt
0.01D
V2EX  ›  OpenClaw

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

  •  
  •   ethusdt · Feb 6 · 1152 views
    This topic created in 80 days ago, the information mentioned may be changed or developed.

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

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

    4 replies    2026-04-20 13:45:28 +08:00
    linbenyi
        1
    linbenyi  
    PRO
       Feb 6
    或许有流式输出可关闭?
    stream: false
    这个样的?
    qdyhgq
        2
    qdyhgq  
       8 days ago
    楼主现在有知道怎么弄了吗,我也是卡这了
    ethusdt
        3
    ethusdt  
    OP
       8 days ago
    @qdyhgq 让🦞写个脚本,每次画图调用脚本。有任何问题都要让🦞解决,这才是🦞的使用方式。
    qdyhgq
        4
    qdyhgq  
       7 days ago
    @ethusdt 原来如此,看到官方现在有个 imageGenerationModel 的参数但是只支持那几个官方 provider 就卡着了,的确直接让它自己解决好了。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   6166 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 49ms · UTC 02:16 · PVG 10:16 · LAX 19:16 · JFK 22:16
    ♥ Do have faith in what you're doing.