Skip to main content
OpenCode (GitHub) is an open-source terminal AI coding agent that works with many providers.
Protocol: OpenAI-compatible
  • Base URL: https://api.orcarouter.ai/v1 (includes /v1)
Claude reasoning models over the OpenAI protocol reject temperature != 1 (400 temperature may only be set to 1 when thinking is enabled). Use a non-reasoning model, or enable reasoningEffort — see Enable thinking.

Install

npm install -g opencode-ai

Configure

Config file: ~/.config/opencode/opencode.json.
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "orcarouter": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "OrcaRouter",
      "options": { "baseURL": "https://api.orcarouter.ai/v1", "apiKey": "sk-orca-..." },
      "models": { "orcarouter/auto": { "name": "OrcaRouter Auto" } }
    }
  },
  "model": "orcarouter/orcarouter/auto"
}
Swap in a specific model if you prefer, e.g. google/gemini-2.5-flash or anthropic/claude-opus-4.8. Model IDs always use the vendor/model format.

Run

opencode run "Reply with exactly: OK"
Expected output: OK.

Notes

  • The base URL must include /v1.
  • Model references use the provider/model format. Because the provider is named orcarouter and the model ID also carries a vendor prefix, the reference is three segments: orcarouter/orcarouter/auto (or orcarouter/anthropic/claude-opus-4.8 for a specific model).
VS Code extension: OpenCode’s official VS Code extension (sst-dev.opencode) runs the CLI inside the editor and shares the same opencode.json — there’s no separate in-editor endpoint setting. Configure it once as above and the extension picks it up.

Enable thinking / reasoning

Set reasoningEffort in the model’s options:
"models": {
  "anthropic/claude-sonnet-4.6": {
    "name": "Sonnet 4.6",
    "options": { "reasoningEffort": "high" }
  }
}
Enabling reasoningEffort also sidesteps the temperature warning above — with thinking enabled, temperature = 1 is legal, so the 400 disappears. For Anthropic-native control, the @ai-sdk/anthropic provider accepts thinking: { type: "enabled", budgetTokens: N }.