OpenCode is an open-source terminal coding agent that supports any OpenAI-compatible provider. Because Tresor speaks the OpenAI Chat Completions protocol, you can route OpenCode through the Tresor router with a one-time config change.
Start OpenCode with opencode, then run /connect and pick Other at the bottom of the provider list. Enter:
tresortr-)$ opencode
> /connect
┌ Add credential
│ ● Other
│ ◇ Enter provider id
│ tresor
│ ◇ Enter your API key
│ tr-...
└
OpenCode stores the key in ~/.local/share/opencode/auth.json.
OpenCode needs a provider.tresor entry to know the base URL and which models to expose. Add it to either the project-local opencode.json or the global ~/.config/opencode/opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"tresor": {
"npm": "@ai-sdk/openai-compatible",
"name": "Tresor",
"options": {
"baseURL": "https://api.tresor.co/v1"
},
"models": {
"global/privatemode/gpt-oss-120b": {
"name": "eu/privatemode/gpt-oss-120b"
},
"global/chutes/kimi-k2.6": { "name": "global/chutes/kimi-k2.6" },
"global/tinfoil/deepseek-v4-pro": {
"name": "global/tinfoil/deepseek-v4-pro"
}
}
}
},
"model": "tresor/kimi-k2.6"
}
The model ids must match those returned by GET /v1/models. Run curl https://api.tresor.co/v1/models -H "Authorization: Bearer $TRESOR_API_KEY" to list the current set.
@ai-sdk/openai-compatible is the AI SDK adapter OpenCode ships for any OpenAI-compatible endpoint that uses /v1/chat/completions. No extra install step is required.Inside OpenCode, run /models and select one of the entries you configured.
> /models
Tresor / gpt-oss 120B
Tresor / Qwen3 Coder 480B
That's it — every prompt OpenCode sends now goes through the Tresor router and returns a verifiable receipt.