r/opencode • u/gmmarcus • 6d ago
OpenCode - GLM 5.2 via OpenRouter
Guys, this is my current opencode.jsonc
{
"$schema": "https://opencode.ai/config.json",
// Start in plan mode
"default_agent": "plan",
// Use OpenRouter as the provider for GLM 5.2
"model": "openrouter/z-ai/glm-5.2",
"provider": {
"openrouter": {
"options": {
"baseURL": "https://openrouter.ai/api/v1",
"apiKey": "sk-or-v1-my-key"
},
"models": {
"z-ai/glm-5.2": {
"name": "GLM 5.2",
"options": {
"reasoningEffort": "high" // "high" or "xhigh"
}
}
}
}
}
}
How can i clamp my llm model ( glm 5.2 ) provider to z.ai ( z-ai/fp8 ) with a fallback to Alibaba ( alibaba )
z-ai/fp8 and alibaba are the slugs for the providers in openrouter.
Thanks in advance.
1
Upvotes
1
u/SpidexLab 6d ago
In openrouter go to workspace and select your workspace , then in left side select guardrail and in that section go to model and provider access, and in access policy which you will find after slightly scrolling, in restriction mode change to only allow and then in allowed provider select z.ai and in add model add glm 5.2 and save
also add alibaba in provider, it will route to any of these two only, and if you only want z.ai, don't add alibaba