Using opencode with Doubleword
Use opencode with Doubleword's API to unlock GLM-5.2, currently the most performant open-source coding model. This integration gives your terminal agent a full 1M-token context window, making it ideal for repository-wide refactoring and long-running background tasks.
Harness comparison on DeepSWE, model fixed at Claude Opus 4.7 (Cursor, Claude Code, opencode). Source: Artificial Analysis, 19 Jun '26
Coding Agent Index — composite of DeepSWE, Terminal-Bench v2, SWE-Atlas-QnA. Source: Artificial Analysis, 19 Jun '26
1. Install opencode
Pick whichever fits your setup:
# macOS / Linux (install script)
curl -fsSL https://opencode.ai/install | bash
# Homebrew
brew install sst/tap/opencode
# npm (any OS)
npm i -g opencode-aiOn Windows, use the npm install or run it under WSL.
Then start it in your project:
opencode
Or start the web interface by running:
opencode webWhile this is running, visit http://127.0.0.1
to open it in your browser.
2. Generate a Doubleword API key
- Sign in to the Doubleword Console.

- In the sidebar, go to API Keys and select Create API Key.

- Copy the key immediately — it's only shown once. Keep it secure and never share it publicly.
3. Connect the provider
Inside your running opencode terminal, add a custom provider:
/connectScroll to Other at the bottom of the provider list, then:
- Provider ID: enter
doubleword - API Key: paste the key you generated in Step 2
4. Configure your context limits
To route traffic to Doubleword and explicitly define your expanded context limits, add the following to your opencode.json. Place it in your project root for project-specific settings, or globally at ~/.config/opencode/opencode.json.
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"doubleword": {
"npm": "@ai-sdk/openai-compatible",
"name": "Doubleword",
"options": {
"baseURL": "https://api.doubleword.ai/v1"
},
"models": {
"zai-org/GLM-5.2-FP8": {
"name": "GLM-5.2 (Doubleword)",
"limit": {
"context": 1048576,
"output": 1048576
}
}
}
}
}
}opencode securely stores the API key you provided in Step 3 and injects it into requests automatically — you don't need to expose it in this file. We are currently working upstream to add Doubleword as a native primary provider.
5. Select the model and verify
With the configuration saved, jump back into opencode and run:
/modelsSelect GLM-5.2 (Doubleword). To confirm the integration works and exercise the new context window, ask it to read across your project:
Read through my
/srcdirectory and summarize the core architecture.
Browse all supported models and volume pricing at the Doubleword docs.