DoublewordDoubleword

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 - DeepSWE (19 Jun '26)

Harness comparison on DeepSWE, model fixed at Claude Opus 4.7 (Cursor, Claude Code, opencode). Source: Artificial Analysis, 19 Jun '26

Artificial Analysis Coding Agent Index vs- Total Tokens (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-ai

On Windows, use the npm install or run it under WSL.

Then start it in your project:

opencode
opencode CLI - Terminal User Interface TUI

Or start the web interface by running:

opencode web

While this is running, visit http://127.0.0.1

to open it in your browser.

opencode browser interface

2. Generate a Doubleword API key

  1. Sign in to the Doubleword Console. Doubleword console login
  2. In the sidebar, go to API Keys and select Create API Key. Generating a Doubleword API key in the Doubleword console
  3. 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:

/connect

Scroll 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:

/models

Select 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 /src directory and summarize the core architecture.


Browse all supported models and volume pricing at the Doubleword docs.