OpenCode with idapt
Found this helpful? Share it:
Found this helpful? Share it:
Set up OpenCode against idapt's compatible APIs with the steps below. This article and the AI Gateway quickstarts lander render the same shared steps, so they never drift.
OpenCode with idapt
One provider block gives OpenCode the full OpenRouter-style catalog through idapt: 200+ models, effort variants, spend caps.
{
"$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.
{
"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.
The quickstart keeps opencode as your surface. When you are ready to leave it, one command imports its chat history into idapt: run Import chats from coding agents (idapt chat import --from opencode), then continue in idapt directly.
Related articles
API keys and scopes
Create a key, choose its scopes, pin it to an API version, rotate it, and cap what it can spend.
Rate limits and errors
Every error shape the API returns, what each rate limit is, and how to handle a wall in code.
Cap what an API key spends
Give every Gateway API key a lifetime, monthly, or daily USD cap, and what a capped-out key returns.
OpenAI-compatible API
Use idapt's 200+ models from any app that speaks the OpenAI API format.
Claude Code with idapt
Point Claude Code at idapt's Anthropic-compatible API with ANTHROPIC_BASE_URL and an idapt key; add MCP for workspace access.
Codex CLI with idapt
Configure OpenAI Codex CLI to route through idapt: a model_provider block in config.toml with the base URL, the chat wire API, and your key.
Cline with idapt
Use Cline with idapt: the OpenAI Compatible provider settings with base URL, key, and any catalog model id.
Import chats from coding agents
Bring your Claude Code, Codex, or OpenCode session history into idapt with one CLI command: dates and tool calls included.
Was this helpful?