Now Z.ai has an official solution to use the package. See below.
First we need to create a custom provider for the Z.ai anthropic API. Follow the instructions for adding a custom provider to opencode.
- Name it
zai-anthropic - Enter your API-key
Edit opencode.json and add this:
"provider": {
"zai-anthropic": {
"npm": "@ai-sdk/anthropic",
"options": {
"baseURL": "https://api.z.ai/api/anthropic/v1"
},
"models": {
"glm-4.5": {
"name": "glm-4.5"
}
}
}Make this model default if you wish:
"model": "zai-anthropic/glm-4.5",

I'm successfully using LiteLLM with the ZAI-GLM-4.5 model.
I've been testing for the last few hours, everything is great. I use it in GitHub Copilot also works in Cline.
The following configuration is working perfectly:
this option simulates working in Claude code