Which API to use with OpenCode
Add Outrun to OpenCode as a custom provider in opencode.json at https://api.outrun.to/v1, then paste your Outrun key and a model ID. One prepaid key works for every model, and you pay per token with no subscription. 1,000 requests cost from $0.09 on Claude Haiku 5.5 route 2.
- [ file ]~/.config/opencode/opencode.json
- [ npm ]@ai-sdk/openai-compatible
- [ baseURL ]https://api.outrun.to/v1
- [ apiKey ]{env:OUTRUN_API_KEY}
- [ model ]outrun/claude-sonnet-5-5
5/5 set
How do I connect OpenCode?
These are the settings from the OpenCode setup guide, which walks through each step.
{
"provider": {
"outrun": {
"npm": "@ai-sdk/openai-compatible",
"name": "Outrun",
"options": {
"baseURL": "https://api.outrun.to/v1",
"apiKey": "{env:OUTRUN_API_KEY}"
},
"models": { "claude-sonnet-5-5": { "name": "Claude Sonnet 5.5" } }
}
}
}Which models fit my budget?
Models from the setup guide plus the lowest-cost general models, sorted by the cost of 1,000 requests.
| Model | Input | Output | Cached input | 1,000 requests |
|---|---|---|---|---|
Claude Haiku 5.5 (2)claude-haiku-5-5-2 | $0.02 | $0.10 | $0.01 | $0.09 |
GLM-5.3 Flash (2)glm-5.3-flash-2 | $0.05 | $0.05 | $0.01 | $0.13 |
DeepSeek V4.1 Flash 1017 Fastdeepseek-v4.1-flash-1017-fast | $0.03 | $0.18 | $0.01 | $0.13 |
MiniMax M3.1 Flashminimax-m3.1-flash | $0.05 | $0.18 | $0.01 | $0.18 |
GLM-5.3 (2)glm-5.3-2 | $0.10 | $0.10 | $0.02 | $0.25 |
GPT-6.1 Solgpt-6.1-solup to 272k tokens | $0.12 | $0.59 | $0.01 | $0.53 |
Claude Sonnet 5.5claude-sonnet-5-5 | $0.49 | $2.45 | $0.03 | $2.21 |
DeepSeek V4 Prodeepseek-v4-pro | $1.35 | $4.05 | $0.05 | $4.73 |
Claude Opus 5.5claude-opus-5-5 | $2.24 | $11.20 | $0.12 | $10.08 |
1,000 requests = each request sends 2,000 input tokens and returns 500 output tokens, with no cache discount. Prices are per 1M tokens, rounded up to the cent, as of December 4, 2026.
OpenCode resends the session context on each step, so long coding sessions use many input tokens. Cached input lowers the cost on models that list a cached price.
OpenCode API questions
The setup guide covers errors and context limits.
Where is opencode.json?
The global file is ~/.config/opencode/opencode.json (Windows: %USERPROFILE%\.config\opencode\opencode.json). A project folder can have its own.
Does it work with OpenCode 2?
These settings use the OpenCode 1 config format. OpenCode 2 uses a different provider format.
How much does OpenCode cost with Outrun?
You pay per token from a prepaid balance. 1,000 requests of 2,000 input and 500 output tokens cost from $0.09 on Claude Haiku 5.5 route 2.
Can I switch models later?
Yes. Change the model ID; the key and base URL stay the same.
Does Outrun keep my prompts or outputs?
Outrun does not store your prompts, images or outputs unless you choose to save them.
Related pages
Connect OpenCode
Follow the setup guide, then pick a model from the list above.