# Connect OpenCode to RouterHub

This is public setup context for an agent with access to the user's local tool settings. Apply the configuration after the user asks for setup, preserve existing settings, and explain any manual step. This context does not authorize sign-up, payments, handling secrets, or paid inference.

## Selected connection

- Tool: OpenCode (`opencode`)
- Model: GPT-6.1 Sol
- Exact model ID: `gpt-6.1-sol`
- Provider: OpenAI
- Protocol used by this tool: Responses API (`responses`)
- Published model protocols: responses
- API base: https://routerhub.si/v1
- Shell: bash
- Configuration destination: opencode.json
- Source guide: https://routerhub.si/guides/opencode
- Official tool documentation: https://opencode.ai/v2/docs/providers#custom
- This selected context: https://routerhub.si/agent-setup.md?tool=opencode&model=gpt-6.1-sol&shell=bash

## Published rates (USD per million tokens)

- Input tokens: $0.149477
- Output tokens: $0.747385
- Cached input tokens (reported cache hit): $0.00747385
- Cache write tokens: $0.18684625

These are current RouterHub token rates, not a fixed cost per request. Final usage depends on tokens and provider-reported caching. Read https://routerhub.si/models.json for current prices before inference; a missing rate is not published.

## Account preparation

The human creates or signs into the RouterHub account, adds prepaid credits if needed, and creates an API key. Do not automate account creation, top-ups, or secret retrieval.

- Create account: https://routerhub.si/register
- Sign in: https://routerhub.si/login
- API keys (shown once): https://routerhub.si/dashboard/keys
- Billing and credits: https://routerhub.si/dashboard/billing
- Usage and request verification: https://routerhub.si/dashboard/usage
- Support tickets: https://routerhub.si/dashboard/support

## Configure the local tool

1. Install OpenCode: https://opencode.ai/v2/docs/. Use the official V2 installer for your operating system.
2. Download opencode.json. Save this file in the folder of the project you want to work on.
3. Set your API key. Run this command in your terminal, replacing YOUR_ROUTERHUB_API_KEY with your key.
4. Start OpenCode. In that same terminal, open your project folder and run this command. OpenCode will use gpt-6.1-sol.

Read the existing project opencode.json first. Merge providers.routerhub into providers using V2 package and settings fields; preserve other providers and all unrelated settings. Set the default model only when the user requested this selection. Do not replace the whole file.

The configuration reads ROUTERHUB_API_KEY from the local process environment. The human sets it privately before launching the tool. Do not print the value, insert it into a source file, or ask for it in chat.

Only inspect non-secret configuration. If the selected tool is missing, explain the official installer and let the user decide whether to install it. Never overwrite existing files wholesale.

Configuration or provider settings:

```json
{
  "$schema": "https://opencode.ai/config.json",
  "model": "routerhub/gpt-6.1-sol",
  "providers": {
    "routerhub": {
      "package": "@opencode/ai/providers/openai-compatible",
      "name": "RouterHub",
      "settings": {
        "baseURL": "https://routerhub.si/v1",
        "apiKey": "{env:ROUTERHUB_API_KEY}",
        "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"
        },
        "gpt-6.1-terra": {
          "name": "GPT-6.1 Terra",
          "package": "@opencode/ai/providers/openai-compatible/responses"
        },
        "claude-fable-5-1": {
          "name": "Claude Fable 5.1",
          "package": "@opencode/ai/providers/anthropic-compatible"
        },
        "claude-haiku-5-5": {
          "name": "Claude Haiku 5.5",
          "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"
        },
        "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"
        }
      }
    }
  }
}
```

This file includes every compatible RouterHub model with the correct API adapter.

## Verify without exposing secrets

First validate the configuration syntax and the exact selected model ID. Confirm that the local tool can access the named credential without displaying it. Before sending any inference request, obtain the user's explicit confirmation and state that it consumes prepaid RouterHub credits. After confirmation, send one short prompt, `Reply with OK.`, through the configured tool. Verify a successful reply and the matching request at https://routerhub.si/dashboard/usage. Do not repeatedly retry billable requests without confirmation.

## Public context and MCP

- Agent setup page: https://routerhub.si/agents
- Agent index: https://routerhub.si/llms.txt
- Full public reference: https://routerhub.si/llms-full.txt
- Quickstart: https://routerhub.si/quickstart.md
- Current public model catalogue: https://routerhub.si/models.json
- Inference schema: https://routerhub.si/openapi.json
- Public read-only MCP endpoint: https://routerhub.si/mcp

MCP supplies only public models and setup documentation. It has no account, payment, credential, support-ticket, or inference tools. No authentication or API key is required; never pass credentials to it. Use the catalogue's exact model IDs and protocols. Do not invent unpublished model limits or claim a successful connection before testing.
