OpenCode setup via the Kiree gateway
Connect OpenCode to kiree.net through opencode.json: a @ai-sdk/openai-compatible provider, the gateway baseURL and catalog models.
Why the direct setup does not cover every case
OpenCode normally uses its built-in providers. An opencode.json @ai-sdk/openai-compatible provider points at the gateway baseURL; the agent runs through kiree.net with catalog models.
Steps to your first request
Get a key
Create a sk-… key in the kiree.net console.
Create opencode.json
In the project root or ~/.config/opencode/opencode.json: a kiree provider with npm @ai-sdk/openai-compatible and the gateway baseURL.
Pick a model
Run opencode, choose kiree/gpt-4o-mini (or another model from the models block) in /models.
"baseURL": "https://kiree.net/v1"
"apiKey": "sk-…"
The key can be passed via an environment variable instead of apiKey in the file. The models block lists exact IDs from the kiree catalog.
Check: opencode → /models → kiree/gpt-4o-mini: the test request goes through the gateway, usage visible in the console.
What to connect in OpenCode
Any text model from the catalog works on one key. Below are popular options to start.
Common errors
Provider does not appear
opencode.json is in the wrong place: check the project root or ~/.config/opencode/; the @ai-sdk/openai-compatible package installs on first run.
401 Unauthorized
apiKey is wrong or missing: check options.apiKey or the environment variable.
404 model_not_found
The model is not listed in the models block or the ID is not from the catalog: add the exact ID.
Frequently asked questions
How do I connect OpenCode through the gateway?+
The custom provider with baseURL kiree.net goes to the gateway directly.
Do I need Anthropic/OpenAI accounts?+
No: a kiree.net key and usage billed by tokens from the balance.
Where is the config located?+
opencode.json in the project root or ~/.config/opencode/opencode.json; the project config takes priority.
Which models should I connect?+
Any catalog text model: gpt-4o-mini, claude-sonnet-4-6, gpt-6-astra, deepseek-v4-pro.
Create a key in a couple of minutes; pay only for actual usage, no subscription required.