Where is opencode.json?
The global OpenCode config is ~/.config/opencode/opencode.json, or %USERPROFILE%\.config\opencode\opencode.json on Windows. You can also put an opencode.json in a project folder for that project only. If the folder or file is missing, create it, then add a provider block with the base URL https://api.outrun.to/v1.
What causes it?
- OpenCode reads the global file in ~/.config/opencode/ and a project file in the folder you open.
- A missing folder is not created for you.
- These settings use the OpenCode 1 config format; OpenCode 2 uses a different provider format.
How do I fix it?
In this order. The OpenCode setup guide has the full setup.
- Create ~/.config/opencode/ if it does not exist (Windows: %USERPROFILE%\.config\opencode\).
- Create opencode.json there and paste the provider block below.
- Save your key in the OUTRUN_API_KEY environment variable and open a new terminal.
- Start opencode and pick a model with /models: it appears as outrun/ followed by the ID.
{
"$schema": "https://opencode.ai/config.json",
"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" }
}
}
}
}Questions
Can I have a project opencode.json and a global one?
Yes. The global file applies everywhere; an opencode.json in a project folder applies to that project.
Why does OpenCode not find my key?
An unset variable is read as an empty key. Save your key in OUTRUN_API_KEY, keep "apiKey": "{env:OUTRUN_API_KEY}" and open a new terminal.
Does Outrun keep my prompts or outputs?
Outrun does not store your prompts, images or outputs unless you choose to save them.
Related pages
Still stuck?
The troubleshooting table lists every error code, or message support on Telegram.