OpenCode has a built-in Z.AI provider, so you do not need to create a custom provider block for a standard GLM setup. Authenticate from OpenCode, choose the provider that matches your account, and select GLM-5.3.
Install OpenCode
Follow the current OpenCode Windows and WSL guide. Check the installed version before configuring a provider:
opencode --version
Create a Z.AI API key. If you subscribe to the GLM Coding Plan, use the plan key and its dedicated provider selection.
Sign in to Z.AI
Run:
opencode auth login
Choose Z.AI for regular API access. Choose Z.AI Coding Plan if the key belongs to a Coding Plan. Paste the corresponding key when prompted.
Select GLM-5.3
Start OpenCode inside your project:
cd /path/to/project
opencode
Open the model picker:
/models
Select GLM-5.3. Z.AI documents it as text-only with a 1-million-token context window and up to 128,000 output tokens. Reasoning is always enabled.
Test the connection
Begin with a read-only request such as asking OpenCode to explain a small module. Then request one limited edit and inspect the diff. This confirms authentication, model selection, and tool calls before you assign a wider repository task.
If GLM-5.3 does not appear, update OpenCode and repeat the login. You can also verify the live model list in Z.AI’s documentation before manually adding a custom provider.
Common errors
An authentication or balance error often means the selected provider does not match the type of key. Log out of that provider and repeat opencode auth login with the correct Z.AI option.
A missing model usually indicates an older OpenCode release or stale provider metadata. Update OpenCode, restart it, and check /models again.
Do not send images to GLM-5.3. Z.AI lists it as text-only. Choose a supported vision model for image or screenshot work.
GLM-5.3 OpenCode check
- Install or update OpenCode
- Create the correct Z.AI API or Coding Plan key
- Run opencode auth login
- Select Z.AI or Z.AI Coding Plan to match the key
- Choose GLM-5.3 with /models and test a small edit
The built-in provider is easier to maintain than an old custom opencode.json block because OpenCode and Z.AI can update the provider metadata without requiring you to rewrite the endpoint configuration.
For Claude Code, see the GLM-5.3 direct setup. For Codex, see GLM-5.3 with Codex CLI.