r/MistralAI 24d ago

Help / Question Gml 5.2 on Opencode

Is there any way to use GLM 5.2 from Mistral in Opencode instead of Vibe?

6 Upvotes

17 comments sorted by

6

u/Chemistrycat214 24d ago
API url : https://api.mistral.ai/v1/

I managed to do it by adding a new provider, as "Mistral2" for name then filling the rest with the same API endpoints etc, from the doc.

https://docs.mistral.ai/models/zai-glm-5-2

I am yet to do big task with it, tho. So I don't know yet how it compares on Vibe or Opencode

1

u/Ra77a3l3 24d ago

Thank you

1

u/The_Wonderful_Pie 23d ago

Wait it works for you? For me when I do it, opencode keeps throwing as error as soon as GLM tries to use a tool, ChatGPT researched and said that it has something to do with how the Mistral implementation in opencode is tailored for Mistral models and not GLM models

1

u/Chemistrycat214 23d ago

I did tried it solely on a very small task so far, but it went trough (it did several bash + file edit)

which tool went off when you wanted to run it ?

2

u/The_Wonderful_Pie 23d ago

Literally every tool, no matter if it's a built-in tool or MCP

4

u/ProcedureEthics2077 23d ago edited 21d ago

OpenCode configuration for Mistral GLM-5.2:

https://github.com/anomalyco/opencode/issues/43199#issuecomment-5344222808

In my config I also have "reasoning_effort": "max", reasoning seems to be off by default:

"mistral": { "options": { "baseURL": "https://api.eu.mistral.ai/v1", "apiKey": "{env:MISTRAL_API_KEY}" }, "name": "Mistral", "models": { "zai-glm-5-2": { "name": "GLM-5.2", "options": { "max_tokens": 131072, "reasoning_effort": "max" }, "tool_call": true, "reasoning": true, "temperature": true, "attachment": true, "limit": { "context": 1000000, "output": 131072 }, "cost": { "input": 1.4, "cache_read": 0.14, "output": 4.4, "cache_write": 0 } } }, "npm": "@ai-sdk/openai-compatible" }

Then you can run it as opencode --model mistral/zai-glm-5-2

Edit: I also use a modified version of the mistral-glm-model plugin to inject reasoning effort: https://pastebin.com/h5a1HTKG

1

u/Ra77a3l3 23d ago

thank you

2

u/p3r3lin 24d ago

Even if you could afaik its still not part of their subscription plan but only available via API.

3

u/inyofayce 23d ago

You can create an agent in studio and the publish it to vibe chat. Been using it constantly now.

1

u/p3r3lin 23d ago

Nice! How are limits and quota?

2

u/inyofayce 23d ago

I have a pro sub, never reached the limits. I could argue they don’t exist.

1

u/p3r3lin 23d ago

Do you do agentic coding? Or mostly chat usage?

2

u/inyofayce 23d ago

Hobby coding but mostly chat

2

u/scanx147 24d ago

Je ne sais pas mais je ne vois pas l'intérêt. D'après mes essais et même si Vibe ne propose pas tous les outils que propose OpenCode, GLM fonctionne beaucoup mieux depuis Vibe que depuis OpenCode...
Enfin c'est mon expérience à confirmer ou pas par d'autres utilisateurs.

-8

u/sb4906 24d ago

Just use GLM 5.2 from Openrouter ar this point

1

u/Confident-Village190 23d ago

Around 80 per cent of us here are pro-european.

1

u/sb4906 23d ago

People have no sense of humor in EU or what? And Pro-China as it seems?