Description
Recently, Mistral has started hosting third-party open models from other providers, starting with GLM-5.2. When manually adding this model to the mistral provider, text responses work fine, but as soon as tools are called, the response validation throws an error:
AI_TypeValidationError: Type validation failed: Value: {"id":"0d56b68eea734ccd983ea66a85ad7781","object":"chat.completion.chunk","created":1787036970,"model":"zai-glm-5-2","choices":[{"index":0,"delta":{"tool_calls":[{"type":"function","function":{"name":"","arguments":"C:\\workspace"},"index":0}],"index":0,"content":""},"finish_reason":null,"logprobs":null}]}.
Error message: [
{
"expected": "string",
"code": "invalid_type",
"path": [
"choices",
0,
"delta",
"tool_calls",
0,
"id"
],
"message": "Invalid input: expected string, received undefined"
}
] (cause: [
{
"expected": "string",
"code": "invalid_type",
"path": [
"choices",
0,
"delta",
"tool_calls",
0,
"id"
],
"message": "Invalid input: expected string, received undefined"
}
])
Plugins
No response
OpenCode version
1.18.18
Steps to reproduce
- Add Mistral manually to the
plugins section in the configuration and define the zai-glm-5-2 model there (see below for example).
- Start a session and select the new model
- See an error as soon as a tool is called
opencode.jsonc:
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"mistral": {
"name": "Mistral (custom)",
"npm": "@ai-sdk/mistral",
"models": {
"zai-glm-5-2": {
"name": "GLM-5.2",
"attachment": true,
"reasoning": true,
"temperature": true,
"tool_call": true,
"limit": {
"context": 1000000,
"output": 131072
},
"modalities": {
"input": [
"text"
],
"output": [
"text"
]
},
"variants": {
"high": {
"reasoningEffort": "high"
}
}
},
}
}
}
}
Screenshot and/or share link
No response
Operating System
Windows 11
Terminal
Windows Terminal
Description
Recently, Mistral has started hosting third-party open models from other providers, starting with GLM-5.2. When manually adding this model to the
mistralprovider, text responses work fine, but as soon as tools are called, the response validation throws an error:Plugins
No response
OpenCode version
1.18.18
Steps to reproduce
pluginssection in the configuration and define thezai-glm-5-2model there (see below for example).opencode.jsonc:
{ "$schema": "https://opencode.ai/config.json", "provider": { "mistral": { "name": "Mistral (custom)", "npm": "@ai-sdk/mistral", "models": { "zai-glm-5-2": { "name": "GLM-5.2", "attachment": true, "reasoning": true, "temperature": true, "tool_call": true, "limit": { "context": 1000000, "output": 131072 }, "modalities": { "input": [ "text" ], "output": [ "text" ] }, "variants": { "high": { "reasoningEffort": "high" } } }, } } } }Screenshot and/or share link
No response
Operating System
Windows 11
Terminal
Windows Terminal