https://bettertoken.ai/v1, and the exact GLM Model ID from the Setup dialog.
Key settings
Prerequisites
- Install OpenCode.
- Create a BetterToken API Key.
- In the Setup dialog, select OpenCode and the GLM provider, then copy the available full Model ID.
Configure with /connect
Start OpenCode and run:bettertoken as the provider id, and paste your BetterToken API Key. Then select bettertoken/YOUR_GLM_MODEL_ID and restart OpenCode.
Manual configuration
Open~/.config/opencode/opencode.json or a project-level opencode.json:
YOUR_API_KEY and YOUR_GLM_MODEL_ID with values from the Setup dialog. Do not reuse a Model ID from an old article; use one currently available to your API Key.
Verify the connection
Selectbettertoken/YOUR_GLM_MODEL_ID in OpenCode and send a short prompt. A response without an API error confirms the setup. Fully restart OpenCode after editing JSON.
Common errors
Related guides
Technical details
Base URL and Model ID
Base URL and Model ID
OpenCode uses OpenAI-compatible Chat Completions. Set only
https://bettertoken.ai/v1 as the Base URL because OpenCode appends the request path. The available GLM Model ID depends on the selected provider and your API Key.
