OpenCode setup

OpenCode is an open-source coding agent for the terminal. Add Claudech as a custom OpenAI-compatible provider in its config file.

Before you start#

  • A Claudech API key from API keys. API access unlocks after your first purchase.

Configuration#

Save your key in an environment variable:

Shell
export CLAUDECH_API_KEY=sk-...

Then add a provider to opencode.json in your project, or to ~/.config/opencode/opencode.json for every project:

JSON
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "claudech": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Claudech",
      "options": {
        "baseURL": "https://api.claudech.com/v1",
        "apiKey": "{env:CLAUDECH_API_KEY}"
      },
      "models": {
        "claude-opus-5-5": { "name": "Claude Opus 5.5" },
        "claude-fable-5-1": { "name": "Claude Fable 5.1" },
        "claude-opus-5": { "name": "Claude Opus 5" },
        "claude-sonnet-5": { "name": "Claude Sonnet 5" }
      }
    }
  },
  "model": "claudech/claude-opus-5-5"
}

Start opencode and run /models to switch between the Claudech models.

Troubleshooting#

SymptomFix
401 or "invalid API key"CLAUDECH_API_KEY is not set in the terminal running OpenCode
Provider missing from /modelsCheck the JSON is valid and the file is in one of the two locations above
404 model_not_foundThe keys under models must be Claudech model ids exactly
402 insufficient_balanceTop up under Billing

See all integrations for other tools. Claudech is an independent service and is not affiliated with the makers of OpenCode.