---
title: Connect OpenCode to RouterHub
description: Add RouterHub as a provider in OpenCode V2. Get configuration, exact save locations, launch instructions, troubleshooting, and common questions.
canonical: https://routerhub.si/guides/opencode
---

# Connect OpenCode to RouterHub
Add RouterHub as a provider in OpenCode V2.
[Try it in web chat](https://routerhub.si/)or choose a tool below
Current models, rates, availability, and limits: [Models & pricing](https://routerhub.si/models)

-
## Step 1: Copy the config
Copy this config and replace `PASTE_ROUTERHUB_KEY_HERE` with your [RouterHub API key](https://routerhub.si/dashboard/keys).
opencode.json

```
{
  "$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.2-sol": {
          "name": "GPT-6.2 Sol",
          "package": "@opencode/ai/providers/openai-compatible/responses"
        },
        "gpt-6.2-astra": {
          "name": "GPT-6.2 Astra",
          "package": "@opencode/ai/providers/openai-compatible/responses"
        },
        "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"
        },
        "gpt-6.1-terra": {
          "name": "GPT-6.1 Terra",
          "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"
        },
        "claude-fable-5-2": {
          "name": "Claude Fable 5.2",
          "package": "@opencode/ai/providers/anthropic-compatible"
        },
        "claude-fable-5-1": {
          "name": "Claude Fable 5.1",
          "package": "@opencode/ai/providers/anthropic-compatible"
        },
        "claude-opus-5-5": {
          "name": "Claude Opus 5.5",
          "package": "@opencode/ai/providers/anthropic-compatible"
        },
        "claude-sonnet-5-5": {
          "name": "Claude Sonnet 5.5",
          "package": "@opencode/ai/providers/anthropic-compatible"
        },
        "claude-haiku-5-5": {
          "name": "Claude Haiku 5.5",
          "package": "@opencode/ai/providers/anthropic-compatible"
        },
        "claude-opus-5": {
          "name": "Claude Opus 5",
          "package": "@opencode/ai/providers/anthropic-compatible"
        },
        "claude-sonnet-5": {
          "name": "Claude Sonnet 5",
          "package": "@opencode/ai/providers/anthropic-compatible"
        },
        "gemini-4-carbon": {
          "name": "Gemini 4 Carbon",
          "package": "@opencode/ai/providers/openai-compatible"
        },
        "gemini-4-argon": {
          "name": "Gemini 4 Argon",
          "package": "@opencode/ai/providers/openai-compatible"
        },
        "gemini-4-neon": {
          "name": "Gemini 4 Neon",
          "package": "@opencode/ai/providers/openai-compatible"
        },
        "gemini-4-hydrogen": {
          "name": "Gemini 4 Hydrogen",
          "package": "@opencode/ai/providers/openai-compatible"
        },
        "grok-4.7": {
          "name": "Grok 4.7",
          "package": "@opencode/ai/providers/openai-compatible"
        },
        "grok-4.6": {
          "name": "Grok 4.6",
          "package": "@opencode/ai/providers/openai-compatible"
        },
        "grok-4.5": {
          "name": "Grok 4.5",
          "package": "@opencode/ai/providers/openai-compatible"
        },
        "deepseek-v4-pro": {
          "name": "DeepSeek V4 Pro",
          "package": "@opencode/ai/providers/openai-compatible"
        },
        "deepseek-v4-pro-uncensored": {
          "name": "DeepSeek V4 Pro Uncensored",
          "package": "@opencode/ai/providers/openai-compatible"
        },
        "deepseek-v4-pro-abliterated": {
          "name": "DeepSeek V4 Pro Abliterated — 100% uncensored",
          "package": "@opencode/ai/providers/openai-compatible"
        },
        "deepseek-v4.1-flash": {
          "name": "DeepSeek V4.1 Flash",
          "package": "@opencode/ai/providers/openai-compatible"
        },
        "deepseek-v4.1-flash-1017": {
          "name": "DeepSeek V4.1 Flash 1017",
          "package": "@opencode/ai/providers/openai-compatible"
        },
        "deepseek-v4.1-flash-uncensored": {
          "name": "DeepSeek V4.1 Flash Uncensored",
          "package": "@opencode/ai/providers/openai-compatible"
        },
        "deepseek-v4.1-flash-1017-uncensored": {
          "name": "DeepSeek V4.1 Flash 1017 Uncensored",
          "package": "@opencode/ai/providers/openai-compatible"
        },
        "deepseek-v4.1-flash-abliterated": {
          "name": "DeepSeek V4.1 Flash Abliterated — 100% uncensored",
          "package": "@opencode/ai/providers/openai-compatible"
        },
        "deepseek-v4.1-flash-1017-abliterated": {
          "name": "DeepSeek V4.1 Flash 1017 Abliterated — 100% uncensored",
          "package": "@opencode/ai/providers/openai-compatible"
        },
        "glm-5.4": {
          "name": "GLM 5.4",
          "package": "@opencode/ai/providers/openai-compatible"
        },
        "glm-5.4-uncensored": {
          "name": "GLM 5.4 Uncensored",
          "package": "@opencode/ai/providers/openai-compatible"
        },
        "glm-5.3": {
          "name": "GLM 5.3",
          "package": "@opencode/ai/providers/openai-compatible"
        },
        "glm-5.3-uncensored": {
          "name": "GLM 5.3 Uncensored",
          "package": "@opencode/ai/providers/openai-compatible"
        },
        "glm-5.3-abliterated": {
          "name": "GLM 5.3 Abliterated — 100% uncensored",
          "package": "@opencode/ai/providers/openai-compatible"
        },
        "glm-5.3-flash": {
          "name": "GLM 5.3 Flash",
          "package": "@opencode/ai/providers/openai-compatible"
        },
        "glm-5.3-flash-uncensored": {
          "name": "GLM 5.3 Flash Uncensored",
          "package": "@opencode/ai/providers/openai-compatible"
        },
        "glm-5.3-flash-abliterated": {
          "name": "GLM 5.3 Flash Abliterated — 100% uncensored",
          "package": "@opencode/ai/providers/openai-compatible"
        },
        "qwen4-max": {
          "name": "Qwen4 Max",
          "package": "@opencode/ai/providers/openai-compatible"
        },
        "qwen3.8-max": {
          "name": "Qwen 3.8 Max",
          "package": "@opencode/ai/providers/openai-compatible"
        },
        "qwen3.8-max-uncensored": {
          "name": "Qwen 3.8 Max Uncensored",
          "package": "@opencode/ai/providers/openai-compatible"
        },
        "kimi-k3.1-pro": {
          "name": "Kimi K3.1 Pro",
          "package": "@opencode/ai/providers/openai-compatible"
        },
        "kimi-k3.1-pro-uncensored": {
          "name": "Kimi K3.1 Pro Uncensored",
          "package": "@opencode/ai/providers/openai-compatible"
        },
        "kimi-k3.1-pro-abliterated": {
          "name": "Kimi K3.1 Pro Abliterated — 100% uncensored",
          "package": "@opencode/ai/providers/openai-compatible"
        }
      }
    }
  }
}
```

[Download config](https://routerhub.si/docs/downloads/routerhub-opencode-all.json).

-
## 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
Run in your terminal

```
opencode
```

Type `/models` and choose RouterHub. Use `/models` anytime to switch.

**Need to install OpenCode?**
Install V2 from the [official OpenCode installation page](https://opencode.ai/v2/docs/). 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](https://routerhub.si/dashboard/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.

## Compatible RouterHub models (44)
These IDs are generated from the current catalogue. Choose the API mode shown below if your client asks for one.

### Responses

- [gpt-6.2-sol](https://routerhub.si/models/gpt-6.2-sol)
- [gpt-6.2-astra](https://routerhub.si/models/gpt-6.2-astra)
- [gpt-6.1-sol](https://routerhub.si/models/gpt-6.1-sol)
- [gpt-6-astra](https://routerhub.si/models/gpt-6-astra)
- [gpt-6.1-terra](https://routerhub.si/models/gpt-6.1-terra)
- [gpt-5.6-sol](https://routerhub.si/models/gpt-5.6-sol)
- [gpt-5.6-terra](https://routerhub.si/models/gpt-5.6-terra)

### Anthropic Messages

- [claude-fable-5-2](https://routerhub.si/models/claude-fable-5-2)
- [claude-fable-5-1](https://routerhub.si/models/claude-fable-5-1)
- [claude-opus-5-5](https://routerhub.si/models/claude-opus-5-5)
- [claude-sonnet-5-5](https://routerhub.si/models/claude-sonnet-5-5)
- [claude-haiku-5-5](https://routerhub.si/models/claude-haiku-5-5)
- [claude-opus-5](https://routerhub.si/models/claude-opus-5)
- [claude-sonnet-5](https://routerhub.si/models/claude-sonnet-5)

### Chat Completions

- [gemini-4-carbon](https://routerhub.si/models/gemini-4-carbon)
- [gemini-4-argon](https://routerhub.si/models/gemini-4-argon)
- [gemini-4-neon](https://routerhub.si/models/gemini-4-neon)
- [gemini-4-hydrogen](https://routerhub.si/models/gemini-4-hydrogen)
- [grok-4.7](https://routerhub.si/models/grok-4.7)
- [grok-4.6](https://routerhub.si/models/grok-4.6)
- [grok-4.5](https://routerhub.si/models/grok-4.5)
- [deepseek-v4-pro](https://routerhub.si/models/deepseek-v4-pro)
- [deepseek-v4-pro-uncensored](https://routerhub.si/models/deepseek-v4-pro-uncensored)
- [deepseek-v4-pro-abliterated](https://routerhub.si/models/deepseek-v4-pro-abliterated)
- [deepseek-v4.1-flash](https://routerhub.si/models/deepseek-v4.1-flash)
- [deepseek-v4.1-flash-1017](https://routerhub.si/models/deepseek-v4.1-flash-1017)
- [deepseek-v4.1-flash-uncensored](https://routerhub.si/models/deepseek-v4.1-flash-uncensored)
- [deepseek-v4.1-flash-1017-uncensored](https://routerhub.si/models/deepseek-v4.1-flash-1017-uncensored)
- [deepseek-v4.1-flash-abliterated](https://routerhub.si/models/deepseek-v4.1-flash-abliterated)
- [deepseek-v4.1-flash-1017-abliterated](https://routerhub.si/models/deepseek-v4.1-flash-1017-abliterated)
- [glm-5.4](https://routerhub.si/models/glm-5.4)
- [glm-5.4-uncensored](https://routerhub.si/models/glm-5.4-uncensored)
- [glm-5.3](https://routerhub.si/models/glm-5.3)
- [glm-5.3-uncensored](https://routerhub.si/models/glm-5.3-uncensored)
- [glm-5.3-abliterated](https://routerhub.si/models/glm-5.3-abliterated)
- [glm-5.3-flash](https://routerhub.si/models/glm-5.3-flash)
- [glm-5.3-flash-uncensored](https://routerhub.si/models/glm-5.3-flash-uncensored)
- [glm-5.3-flash-abliterated](https://routerhub.si/models/glm-5.3-flash-abliterated)
- [qwen4-max](https://routerhub.si/models/qwen4-max)
- [qwen3.8-max](https://routerhub.si/models/qwen3.8-max)
- [qwen3.8-max-uncensored](https://routerhub.si/models/qwen3.8-max-uncensored)
- [kimi-k3.1-pro](https://routerhub.si/models/kimi-k3.1-pro)
- [kimi-k3.1-pro-uncensored](https://routerhub.si/models/kimi-k3.1-pro-uncensored)
- [kimi-k3.1-pro-abliterated](https://routerhub.si/models/kimi-k3.1-pro-abliterated)

## 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 a timeout occurs, check Usage and the request ID before retrying. The request may still be processing.

**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. Run `/reload` 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](https://routerhub.si/dashboard/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.

[Browse setup guides](https://routerhub.si/guides) · [API reference](https://routerhub.si/docs#api-reference)
