# 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`
- 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/docs/providers/#custom-provider
- This selected context: https://routerhub.si/agent-setup.md?tool=opencode&model=gpt-6.1-sol&shell=bash

## 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/docs/. Use the official 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 provider.routerhub into provider; 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",
  "provider": {
    "routerhub": {
      "npm": "@ai-sdk/openai",
      "name": "RouterHub",
      "options": {
        "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"
        },
        "gpt-6-astra": {
          "name": "GPT-6 Astra"
        },
        "claude-fable-5-1": {
          "name": "Claude Fable 5.1",
          "provider": {
            "npm": "@ai-sdk/anthropic"
          }
        },
        "codex-auto-review": {
          "name": "Codex Auto Review"
        },
        "gpt-5.5": {
          "name": "GPT-5.5"
        },
        "gpt-5.6-sol": {
          "name": "GPT-5.6 Sol"
        },
        "gpt-5.6-terra": {
          "name": "GPT-5.6 Terra"
        },
        "gpt-6-sol": {
          "name": "GPT-6 Sol"
        },
        "claude-fable-5": {
          "name": "Claude Fable 5",
          "provider": {
            "npm": "@ai-sdk/anthropic"
          }
        },
        "claude-haiku-4-5-20251001": {
          "name": "Claude Haiku 4.5 20251001",
          "provider": {
            "npm": "@ai-sdk/anthropic"
          }
        },
        "claude-opus-4-6": {
          "name": "Claude Opus 4.6",
          "provider": {
            "npm": "@ai-sdk/anthropic"
          }
        },
        "claude-opus-4-7": {
          "name": "Claude Opus 4.7",
          "provider": {
            "npm": "@ai-sdk/anthropic"
          }
        },
        "claude-opus-4-8": {
          "name": "Claude Opus 4.8",
          "provider": {
            "npm": "@ai-sdk/anthropic"
          }
        },
        "claude-opus-5": {
          "name": "Claude Opus 5",
          "provider": {
            "npm": "@ai-sdk/anthropic"
          }
        },
        "claude-opus-5-5": {
          "name": "Claude Opus 5.5",
          "provider": {
            "npm": "@ai-sdk/anthropic"
          }
        },
        "claude-sonnet-4-6": {
          "name": "Claude Sonnet 4.6",
          "provider": {
            "npm": "@ai-sdk/anthropic"
          }
        },
        "claude-sonnet-5": {
          "name": "Claude Sonnet 5",
          "provider": {
            "npm": "@ai-sdk/anthropic"
          }
        },
        "claude-sonnet-5-5": {
          "name": "Claude Sonnet 5.5",
          "provider": {
            "npm": "@ai-sdk/anthropic"
          }
        },
        "deepseek-v4.1-flash": {
          "name": "DeepSeek V4.1 Flash",
          "provider": {
            "npm": "@ai-sdk/openai-compatible"
          }
        },
        "glm-5.3": {
          "name": "GLM 5.3",
          "provider": {
            "npm": "@ai-sdk/openai-compatible"
          }
        },
        "glm-5.3-flash": {
          "name": "GLM 5.3 Flash",
          "provider": {
            "npm": "@ai-sdk/openai-compatible"
          }
        }
      }
    }
  }
}
```

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.
