OpenCode
OpenCode Setup Guide
Add UnoRouter as a custom provider in OpenCode and pick any model as the active agent.
Overview
OpenCode reads providers from a JSON config. Add UnoRouter with the OpenAI-compatible adapter to use any UnoRouter model.
Quick Config
Paste these into the client. Your key auto-fills when signed in.
text
Base URL: https://api.unorouter.com/v1
API Key: YOUR_API_KEYCompatibility
Chat CompletionsStreamingTool calling
Step-by-step setup
- 1Open the OpenCode config file
Press Ctrl + O inside OpenCode and paste the path. On Windows, replace YOUR_USER with your username.
textC:/Users/YOUR_USER/.config/opencode/opencode.json - 2Replace the file contents
Wipe the file and paste the UnoRouter provider block. Add your API key and pick a model from the catalog.
json{ "$schema": "https://opencode.ai/config.json", "provider": { "unorouter": { "name": "UnoRouter", "npm": "@ai-sdk/openai-compatible", "discoverModels": true, "options": { "apiKey": "YOUR_API_KEY", "baseURL": "https://api.unorouter.com/v1" } } } } - 3Save and reload
Press Ctrl + S, then Ctrl + Shift + P and run Developer: Reload Window.
- 4Pick a model
Open the model picker and switch to your new model. The adapter handles streaming and tool calling.
Recommended models
Free models that work here. Paste any model id into the client.
glm-5.3-search:freeglm-5.3-think-search:freeglm-5.3-thinking:freeglm-5.3:freeqwen-3.8-27b:free
Gotchas
- With "discoverModels": true, OpenCode fetches the full UnoRouter catalog from /v1/models on startup, so every model appears in the picker without listing them by hand.
- If Developer: Reload Window does not show your provider, check the JSON saved without trailing commas.
- Use exact model ids from the UnoRouter catalog. Strip any leading provider prefix a copy-paste added.
- Without auto-discovery, older OpenCode needs a "models" block listing exact ids (e.g. {"gemini-3.1-flash-lite": {}}) and a restart.