Docs / opencode

opencode

Terminal coding agent — our recommended starting point.

opencode is an open-source terminal coding agent. This is our recommended starting point: full agent capability, works with every model on your plan, set up in under five minutes.

Works best with: Coding plan (parallel slots, 160K context). Agent Runner works well too.

1. Install opencode

bash
curl -fsSL https://opencode.ai/install | bash

2. Set your key

bash
export COBBLE_API_KEY="sk-cobble-..."

Add it to your shell profile so opencode always finds it.

3. Add Cobble as a provider

Create or edit ~/.config/opencode/opencode.json:

json
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "cobble": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Cobble",
      "options": {
        "baseURL": "https://api.cobble.network/v1",
        "apiKey": "{env:COBBLE_API_KEY}"
      },
      "models": {
        "deepseek/deepseek-v4-flash": { "name": "DeepSeek V4 Flash" },
        "qwen/qwen3.6-35b-a3b": { "name": "Qwen3.6 35B A3B" },
        "qwen/qwen3.5-122b-a10b": { "name": "Qwen3.5 122B A10B" }
      }
    }
  }
}

The model keys must match Cobble's catalog IDs exactly — copy them from /v1/models rather than typing them. List only the models on your plan; opencode shows exactly what you configure.

4. Run it

bash
opencode

Pick a Cobble model with /models. Start with deepseek/deepseek-v4-flash for coding work.

Troubleshooting

  • Provider doesn't appear — opencode reads config at startup; restart it after editing.
  • 401 — the env var isn't visible to opencode. Check echo $COBBLE_API_KEY in the same terminal.
  • 404 on a model — the model key in your config doesn't match the catalog ID. Copy it exactly from /v1/models.
  • 429 mid-session — you've hit your plan window. Enable wallet spillover in the dashboard for uninterrupted sessions, or wait for the window to roll forward.

Plan notes

Long agent sessions burn one request per tool-call round — a big refactor can be 150+ requests. On the Coding plan you have 2 parallel slots, so opencode's parallel tool calls don't queue. If you routinely hit the window, wallet spillover at API rates is cheaper than idling.