opencode
opencode copied to clipboard
Getting "AI_APICallError: Invalid API parameter, please check the documentation." in opencode with zAI glm 4.6
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.
ref: https://docs.z.ai/devpack/mcp/vision-mcp-server
This issue might be a duplicate of existing issues. Please check:
- #2898: GLM Coding Plan - Frequent Errors (reports same "Invalid API Parameter. Check the documentation." error with GLM models, especially pronounced in 4.6)
- #2557: AI_APICallError: The messages parameter is illegal. Please check the documentation. - Zhipu AI GLM-4.5 (similar API parameter error with z.ai GLM configuration)
- #2903: GLM-4.6 model fails to use web search tools (GLM-4.6 specific issues with tool usage, though different symptoms)
Feel free to ignore if none of these address your specific case with MCP vision server integration.
I've described the same issue here https://github.com/sst/opencode/issues/2941#issuecomment-3364313110
does this specifically happen with attachments that are images?
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
hm we will need to update models.dev for that then
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.
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
Also hit this error with GLM 4.6 when attaching images:
![]()
e: it's related to this: 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.
I'm using GLM Coding Max and still having the same issue.
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
Hey! Encountered this too. Wondering if it'd make sense to have opencode detect this pattern and smooth it out:
- When GLM-4.6 user attaches an image and hits this error
- Show a prompt: "GLM-4.6 vision requires the Z.AI Vision MCP Server. Would you like to add it now?"
- If yes → auto-run the MCP installation
- Resume conversation with image routed to MCP tool
Curious what you think happy to explore implementation if it resonates.
