OpenCode with idapt
One provider block gives OpenCode the full OpenRouter-style catalog through idapt: 200+ models, effort variants, spend caps.
- 1
Point it at idapt
json{ "$schema": "https://opencode.ai/config.json", "provider": { "openrouter": { "name": "idapt", "options": { "baseURL": "https://idapt.app/api/openrouter/v1" } } } }Keep the provider id "openrouter" so opencode loads its bundled OpenRouter catalog; "name" is only the display label. Add the key with /connect inside opencode, or with "apiKey": "{env:IDAPT_API_KEY}" here. Project config sits at the repo root, user-wide at ~/.config/opencode/opencode.json.
- 2
Going further
json{ "model": "openrouter/anthropic/claude-sonnet-5" }Top-level model ids compose as provider/model. Latest aliases carry a leading ~, for example openrouter/~openai/gpt-sol-latest.
GOOD TO KNOW
API keys and scopesOpenAI-compatible API referenceOpenRouter-compatible API referenceRate limits and errors