---
title: Connect Claude Code to RouterHub
description: Connect Claude Code using your RouterHub key and the Messages API. Get configuration, exact save locations, launch instructions, troubleshooting, and common questions.
canonical: https://routerhub.si/guides/claude-code
---

# Connect Claude Code to RouterHub
Connect Claude Code using your RouterHub key and the Messages API.
[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).
settings.json

```
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://routerhub.si",
    "ANTHROPIC_AUTH_TOKEN": "PASTE_ROUTERHUB_KEY_HERE",
    "API_TIMEOUT_MS": "600000",
    "CLAUDE_STREAM_FIRST_BYTE_TIMEOUT_MS": "600000",
    "CLAUDE_STREAM_IDLE_TIMEOUT_MS": "600000",
    "CLAUDE_BYTE_STREAM_IDLE_TIMEOUT_MS": "600000"
  },
  "modelPicker": {
    "replaceBuiltInOptions": true,
    "options": [
      {"model":"claude-fable-5-1","label":"Claude Fable 5.1"},
      {"model":"claude-haiku-5-5","label":"Claude Haiku 5.5"},
      {"model":"claude-opus-5-5","label":"Claude Opus 5.5"},
      {"model":"claude-sonnet-5-5","label":"Claude Sonnet 5.5"}
    ]
  }
}
```

[Download config](https://routerhub.si/docs/downloads/routerhub-claude-models.json) · Claude models only.

-
## Step 2: Save the file

### macOS / Linux
Save as `~/.claude/settings.json`.

### Windows
Save as `%USERPROFILE%/.claude/settings.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 Claude Code
Run in your terminal

```
claude
```

Type `/model` and choose a listed Claude model, not Default. Use `/model` to switch later. Run `/status` to check that the base URL is `https://routerhub.si`.

**Need to install Claude Code?**
Use the [official Claude Code installer](https://code.claude.com/docs/en/setup) for your OS. Update to a current release; the custom picker needs 2.1.242+ and some models need a newer release.

**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.

## Troubleshooting

**A slow request or stream times out**
The config sets `API_TIMEOUT_MS`, `CLAUDE_STREAM_FIRST_BYTE_TIMEOUT_MS`, `CLAUDE_STREAM_IDLE_TIMEOUT_MS`, and `CLAUDE_BYTE_STREAM_IDLE_TIMEOUT_MS` to `600000`. These are milliseconds: a ten-minute header/first-byte wait and stream-idle allowance, not a total session limit. Watchdog coverage depends on the connection type and client version. Restart Claude Code after changing the settings. Check Usage and the request ID before manually retrying.

**Wrong URL or a 404**
Use `ANTHROPIC_BASE_URL=https://routerhub.si`. Claude Code appends `/v1/messages` itself.

**The wrong key or account is used**
Check the credential source in `/status`. Another `ANTHROPIC_API_KEY`, credential helper, project config, or managed setting may conflict. Inspect it rather than deleting saved credentials. Check RouterHub usage after a test.

**The model is missing**
Check its exact ID and current Messages API availability. A Chat Completions-only model is not a replacement.

**A feature or streaming request fails**
A basic reply does not verify all gateway features. Send support the redacted error and request ID, and check credits before retrying.

Still stuck? [Contact support](https://routerhub.si/dashboard/support).

## Common questions

**Does this use my Claude subscription?**
No. This configuration uses your RouterHub API key and prepaid balance. A personal Claude login does not configure RouterHub.

**Does this also configure the VS Code extension?**
These steps are for the CLI. The extension’s own login check can need VS Code user settings; see the linked gateway documentation. Claude Desktop uses its separate Gateway panel.

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