Step 1: Copy the config
Copy this config and replace
PASTE_ROUTERHUB_KEY_HEREwith your RouterHub API key.{ "$schema": "https://opencode.ai/config.json", "providers": { "routerhub": { "package": "@opencode/ai/providers/openai-compatible", "name": "RouterHub", "settings": { "baseURL": "https://routerhub.si/v1", "apiKey": "PASTE_ROUTERHUB_KEY_HERE", "timeout": 600000, "headerTimeout": 600000, "chunkTimeout": 600000 }, "models": { "gpt-6.1-sol": {"name":"GPT-6.1 Sol","package":"@opencode/ai/providers/openai-compatible/responses"}, "gpt-6-astra": {"name":"GPT-6 Astra","package":"@opencode/ai/providers/openai-compatible/responses"}, "claude-fable-5-1": {"name":"Claude Fable 5.1","package":"@opencode/ai/providers/anthropic-compatible"}, "codex-auto-review": {"name":"Codex Auto Review","package":"@opencode/ai/providers/openai-compatible/responses"}, "gpt-5.5": {"name":"GPT-5.5","package":"@opencode/ai/providers/openai-compatible/responses"}, "gpt-5.6-sol": {"name":"GPT-5.6 Sol","package":"@opencode/ai/providers/openai-compatible/responses"}, "gpt-5.6-terra": {"name":"GPT-5.6 Terra","package":"@opencode/ai/providers/openai-compatible/responses"}, "gpt-6-sol": {"name":"GPT-6 Sol","package":"@opencode/ai/providers/openai-compatible/responses"}, "claude-fable-5": {"name":"Claude Fable 5","package":"@opencode/ai/providers/anthropic-compatible"}, "claude-haiku-4-5-20251001": {"name":"Claude Haiku 4.5 20251001","package":"@opencode/ai/providers/anthropic-compatible"}, "claude-haiku-5-5": {"name":"Claude Haiku 5.5","package":"@opencode/ai/providers/anthropic-compatible"}, "claude-opus-4-6": {"name":"Claude Opus 4.6","package":"@opencode/ai/providers/anthropic-compatible"}, "claude-opus-4-7": {"name":"Claude Opus 4.7","package":"@opencode/ai/providers/anthropic-compatible"}, "claude-opus-4-8": {"name":"Claude Opus 4.8","package":"@opencode/ai/providers/anthropic-compatible"}, "claude-opus-5": {"name":"Claude Opus 5","package":"@opencode/ai/providers/anthropic-compatible"}, "claude-opus-5-5": {"name":"Claude Opus 5.5","package":"@opencode/ai/providers/anthropic-compatible"}, "claude-sonnet-4-6": {"name":"Claude Sonnet 4.6","package":"@opencode/ai/providers/anthropic-compatible"}, "claude-sonnet-5": {"name":"Claude Sonnet 5","package":"@opencode/ai/providers/anthropic-compatible"}, "claude-sonnet-5-5": {"name":"Claude Sonnet 5.5","package":"@opencode/ai/providers/anthropic-compatible"}, "grok-4.5": {"name":"Grok 4.5"}, "grok-4.6": {"name":"Grok 4.6"}, "grok-4.7": {"name":"Grok 4.7"}, "deepseek-v4-pro": {"name":"DeepSeek V4 Pro"}, "deepseek-v4-pro-uncensored": {"name":"DeepSeek V4 Pro Uncensored"}, "deepseek-v4.1-flash": {"name":"DeepSeek V4.1 Flash"}, "deepseek-v4.1-flash-uncensored": {"name":"DeepSeek V4.1 Flash Uncensored"}, "glm-5.3-flash": {"name":"GLM 5.3 Flash"}, "glm-5.3-flash-uncensored": {"name":"GLM 5.3 Flash Uncensored"}, "glm-5.3": {"name":"GLM 5.3"}, "glm-5.3-uncensored": {"name":"GLM 5.3 Uncensored"}, "gemini-4-argon": {"name":"Gemini 4 Argon"}, "glm-5.3-flash-abliterated": {"name":"GLM 5.3 Flash Abliterated"}, "glm-5.3-abliterated": {"name":"GLM 5.3 Abliterated"}, "qwen3.8-max": {"name":"Qwen 3.8 Max"}, "qwen3.8-max-uncensored": {"name":"Qwen 3.8 Max Uncensored"}, "kimi-k3.1-pro": {"name":"Kimi K3.1 Pro"}, "kimi-k3.1-pro-uncensored": {"name":"Kimi K3.1 Pro Uncensored"}, "deepseek-v4.1-flash-abliterated": {"name":"DeepSeek V4.1 Flash Abliterated"}, "deepseek-v4-pro-abliterated": {"name":"DeepSeek V4 Pro Abliterated"}, "deepseek-v4.1-flash-1017-abliterated": {"name":"DeepSeek V4.1 Flash 1017 Abliterated"} } } } }Step 2: Save the file
macOS / Linux
Save as
~/.config/opencode/opencode.json.Windows
Save as
%USERPROFILE%/.config/opencode/opencode.json.Create any missing folders. If the file already exists, merge these settings without replacing your other settings. Keep your key private and out of repositories.
Step 3: Open OpenCode
opencodeType
/modelsand choose RouterHub. Use/modelsanytime to switch.
Need to install OpenCode?
Install V2 from the official OpenCode installation page. Then follow the three steps above.
Check the connection (optional)
When you’re ready to use credits, open an empty project and send this short test:
Reply with OK. Do not read files, run commands, or make edits.
Open RouterHub usage and check that the request appears under the right model. Keep auto-approval off while testing. A text reply checks the connection, not all coding features.
Troubleshooting
A slow request times out
The config sets timeout, headerTimeout, and chunkTimeout to 600000 milliseconds under providers.routerhub.settings. These bound the whole request, response-header wait, and gap between chunks respectively. The whole-request limit still caps an actively streaming response at ten minutes. These are API timers, not shell or MCP tool timeouts. If it expires, inspect Usage and the request ID before manually retrying; a client timeout does not prove the upstream request stopped.
The configuration is not accepted
Check that you installed OpenCode V2. This config uses providers, package, and settings, not legacy V1 fields.
RouterHub or my model is missing
Check that the file is named opencode.json, not opencode.json.txt, and saved in your home .config/opencode folder. Restart OpenCode and reopen /models. If you set XDG_CONFIG_HOME, use that directory instead of ~/.config. A project or managed config may override your user settings.
401 or 404 error
Use a RouterHub key, https://routerhub.si/v1, and an exact catalogue model ID. Confirm current availability and the required API; do not append an API method to the base URL.
Streaming or coding tools fail
A text reply does not verify every agent feature. Stop repeated retries and send support the redacted error and request ID, never your key.
Still stuck? Contact support.
Common questions
Do I need to configure every model separately?
No. The universal download includes the full dated catalogue under one RouterHub provider, with model-level API runtime overrides. Switch with /models. Download an updated config when the catalogue changes; merge rather than overwrite your own settings.
Where is my API key saved?
In your private user-level opencode.json, not your project. Downloads contain only a placeholder. Never commit or share the filled-in file. Advanced users can use OpenCode’s environment or file substitutions instead.