You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Getting "AI_APICallError: Invalid API parameter, please check the documentation." in opencode with zAI glm 4.6 #2944
I have ZAI coding plan that I use with opencode . ZAI use vision mcp server for image/image and text input. It works fine in factory cli or claude code. but when I use image/image and text input in opencode and glm 4.6 it throws this error.
This issue might be a duplicate of existing issues. Please check:
GLM Coding Plan - Frequent Errors #2898: GLM Coding Plan - Frequent Errors (reports same "Invalid API Parameter. Check the documentation." error with GLM models, especially pronounced in 4.6)
does this specifically happen with attachments that are images?
yes yes specifically happen with attachments that are images, because glm 4.6 doesnt support image input and need to use vision mcp server, which works well with droid cli and claude code cli
Yeah ig they don't support them, we can make the tui guard against this pretty easily tho, to be able to continue your convo I recommend doing a /undo and then deleting the image attachments
It looks like there is a special mcp server they want you to be using, if it is an mcp server then @ ing the file won't work correctly, nor will a drag and drop (because they are unrelated to mcp servers).
In this case the llm would have to call the mcp server tool right
Reacted by Max Shapira, shekohex, Jensen, Jaehoon Choi and kaanmertkoc
I'm encountering the exact same error with GLM-5 Turbo in OpenCode TUI (v1.2.x on Windows). Steps to reproduce:
Select glm-5-turbo as the model in OpenCode TUI
Paste an image path (e.g., C:\path\to\screenshot.png)
Send the message
Error: AI_APICallError: API 调用参数有误,请检查文档。 (Invalid API parameter, please check documentation.)
After investigating, the root cause appears straightforward:
GLM-5 Turbo is a text-only model — it does NOT support native vision/image input. This is confirmed by:
Z.AI official docs: GLM-5-Turbo — no mention of image input support
Z.AI official docs: GLM-5V-Turbo — the vision variant with CogViT encoder, released 2026-04-01
Zed IDE promote dev -> prod #51892 — same exact error, closed as "GLM-5 was never equipped with visual capabilities"
When an image is pasted in TUI, OpenCode encodes it as base64 data:image/... and includes it in the API request. GLM-5's API rejects this because it doesn't understand image content blocks in messages. This is consistent with Issue #14673 (data: URL vs file path for MCP) and #5101 (switching from vision to non-vision model breaks thread).
Workarounds that work today:
Switch to GLM-5V-Turbo — the vision-capable variant of GLM-5, supports image + text input natively
Use @filepath syntax to reference images so MCP tools (look_at, understand_image) can handle them instead of sending images directly to the model
Community plugin: npx -y opencode-glm-clipboard@latest — detects pasted images, saves to temp file, replaces with file path for MCP tools
/compact before switching from a vision model to GLM-5 to clear image history from context
Suggestion for OpenCode: it would be great if the TUI could detect when the current model doesn't support image input and either:
Warn the user before sending
Auto-route images through MCP tools transparently
Strip image content blocks and warn instead of failing with an API error
This is essentially the same class of problem as #5101 (which was closed as fixed) — models without vision capability should not have image content sent to them.
Activity
github-actions commentedon Oct 3, 2025
This issue might be a duplicate of existing issues. Please check:
Feel free to ignore if none of these address your specific case with MCP vision server integration.
wKich commentedon Oct 3, 2025
I've described the same issue here #2941 (comment)
rekram1-node commentedon Oct 3, 2025
does this specifically happen with attachments that are images?
moinulmoin commentedon Oct 3, 2025
yes yes specifically happen with attachments that are images, because glm 4.6 doesnt support image input and need to use vision mcp server, which works well with droid cli and claude code cli
rekram1-node commentedon Oct 3, 2025
hm we will need to update models.dev for that then
naltun commentedon Oct 14, 2025
Also hit this error with GLM 4.6 when attaching images:


e: it's related to this: https://docs.z.ai/devpack/mcp/vision-mcp-server
tl;dr Image and Video processing is only available with GLM Coding Pro plans and up. I am using GLM Coding Lite and can validate this.
rekram1-node commentedon Oct 14, 2025
Yeah ig they don't support them, we can make the tui guard against this pretty easily tho, to be able to continue your convo I recommend doing a /undo and then deleting the image attachments
xshapira commentedon Oct 15, 2025
I'm using GLM Coding Max and still having the same issue.
rekram1-node commentedon Oct 15, 2025
Are you sending images?
It looks like there is a special mcp server they want you to be using, if it is an mcp server then @ ing the file won't work correctly, nor will a drag and drop (because they are unrelated to mcp servers).
In this case the llm would have to call the mcp server tool right
kaanmertkoc commentedon Nov 4, 2025
Hey! Encountered this too. Wondering if it'd make sense to have opencode
detect this pattern and smooth it out:
Would you like to add it now?"
Curious what you think happy to explore implementation if it resonates.
WilfredLemus commentedon Feb 23, 2026
Hi! Quick update from my side: I built and published a plugin that works around the GLM clipboard image issue in OpenCode.
It keeps the same paste UX (Cmd+V / clipboard image) for GLM models by:
Plugin:
Install:
npx -y opencode-glm-clipboard@latest
This is a temporary workaround while we wait for a native fix in OpenCode.
github-actions commentedon Apr 24, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.
skywalker-35 commentedon May 12, 2026
I'm encountering the exact same error with GLM-5 Turbo in OpenCode TUI (v1.2.x on Windows). Steps to reproduce:
glm-5-turboas the model in OpenCode TUIC:\path\to\screenshot.png)AI_APICallError: API 调用参数有误,请检查文档。(Invalid API parameter, please check documentation.)After investigating, the root cause appears straightforward:
GLM-5 Turbo is a text-only model — it does NOT support native vision/image input. This is confirmed by:
When an image is pasted in TUI, OpenCode encodes it as base64
data:image/...and includes it in the API request. GLM-5's API rejects this because it doesn't understand image content blocks in messages. This is consistent with Issue #14673 (data: URL vs file path for MCP) and #5101 (switching from vision to non-vision model breaks thread).Workarounds that work today:
@filepathsyntax to reference images so MCP tools (look_at, understand_image) can handle them instead of sending images directly to the modelnpx -y opencode-glm-clipboard@latest— detects pasted images, saves to temp file, replaces with file path for MCP tools/compactbefore switching from a vision model to GLM-5 to clear image history from contextSuggestion for OpenCode: it would be great if the TUI could detect when the current model doesn't support image input and either:
This is essentially the same class of problem as #5101 (which was closed as fixed) — models without vision capability should not have image content sent to them.