Skip to content
rout.im Documentation V2
DocumentationTerminal agents

Claude Code

Connect the Claude Code CLI to Routim with one command.

Configure Claude Code

Install Claude Code if needed. Merge the env entries below into your settings and replace YOUR_ROUTIM_API_KEY with your key.

If you use a custom CLAUDE_CONFIG_DIR, edit the settings.json in that directory.

~/.claude/settings.json
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api2.rout.im",
    "ANTHROPIC_AUTH_TOKEN": "YOUR_ROUTIM_API_KEY"
  }
}

Start Claude Code

Clear any previously configured ANTHROPIC_API_KEY from this profile and the shell, then start Claude Code with a model ID you can access.

Start Claude Code
claude --model MODEL_ID
DocumentationTerminal agents

Codex

Use Routim as an OpenAI Responses provider in Codex.

Add the provider below to your Codex config.toml. The default file is ~/.codex/config.toml, or %USERPROFILE%\.codex\config.toml on Windows. If you set CODEX_HOME, use that directory.

Choose MODEL_ID from your model list. Set ROUTIM_API_KEY in Bash or Zsh or PowerShell, then run codex in the same terminal.

config.toml
model = "MODEL_ID"
model_provider = "routim"

[model_providers.routim]
name = "Routim"
base_url = "https://api2.rout.im/v1"
env_key = "ROUTIM_API_KEY"
wire_api = "responses"
requires_openai_auth = false
supports_websockets = false
DocumentationTerminal agents

OpenCode

Connect OpenCode 1 to Routim through the Anthropic Messages protocol.

Merge this provider into your project's opencode.json. This configuration uses OpenCode 1 and the Anthropic Messages protocol.

Replace every MODEL_ID with the same ID from your model list. Set ROUTIM_API_KEY in Bash or Zsh or PowerShell, then run opencode in the same terminal.

opencode.json
{
  "model": "routim/MODEL_ID",
  "provider": {
    "routim": {
      "name": "Routim",
      "npm": "@ai-sdk/anthropic",
      "options": {
        "baseURL": "https://api2.rout.im/v1",
        "apiKey": "{env:ROUTIM_API_KEY}"
      },
      "models": {
        "MODEL_ID": {
          "name": "MODEL_ID"
        }
      }
    }
  }
}
DocumentationDesktop apps

Claude Desktop

Connect Claude Desktop to Routim using a named profile.

Open Claude Desktop. In the macOS menu bar, open Help → Troubleshooting → Enable Developer Mode.

  1. Save the example below as routim.json and replace YOUR_ROUTIM_API_KEY with your key.
  2. Open Developer → Configure Third-Party Inference. In the configuration picker, choose Import configuration and select the file.
  3. Use Test connection, then choose Apply Changes → Relaunch now. Delete the import file once configured because it contains your key.
routim.json
{
  "deploymentDisplayName": "Routim",
  "inferenceProvider": "gateway",
  "inferenceGatewayBaseUrl": "https://api2.rout.im",
  "inferenceGatewayApiKey": "YOUR_ROUTIM_API_KEY",
  "inferenceGatewayAuthScheme": "bearer"
}

Claude Desktop configuration guide

API quickstart

Get an API key and authenticate requests to Routim.

Authorization

Sign in to the Routim console and create an API key.

API base URL
https://api2.rout.im/v1

Send your personal V2 API key as a Bearer token. For team keys, use the team endpoint.

HTTP header
Authorization: Bearer YOUR_ROUTIM_API_KEY

Open curl examples →

Team API

Open the organization in the V2 console and create a key in API keys. Team keys begin with rtim_team_. Usage counts against the organization balance and the member’s limits.

Claude Messages · POST
https://console2.rout.im/team-api/v1/messages

Use the same Messages payload as in the curl example, with a team key and a model configured for team billing. In a client that takes an Anthropic base URL, use https://console2.rout.im/team-api.

curl

List models and send an inference request from your terminal.

Run the curl examples in Bash or Zsh. On Windows, use Git Bash or WSL.

Set the key in Bash or Zsh
Terminal
printf "Routim API key: "; IFS= read -r -s ROUTIM_API_KEY; printf "\n"
export ROUTIM_API_KEY
Set the key in PowerShell 7 for Windows clients
PowerShell
$env:ROUTIM_API_KEY = Read-Host "Routim API key" -MaskInput

List available models

GET /v1/models
curl --fail-with-body "https://api2.rout.im/v1/models" \
  -H "Authorization: Bearer $ROUTIM_API_KEY"

Send a message

Replace MODEL_ID with a Claude model ID from your model list.

POST /v1/messages
curl --fail-with-body "https://api2.rout.im/v1/messages" \
  -H "Authorization: Bearer $ROUTIM_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "content-type: application/json" \
  -d '{
    "model": "MODEL_ID",
    "max_tokens": 256,
    "messages": [{"role": "user", "content": "Hello!"}]
  }'

To continue a conversation, send the prior messages in the next request. If you get 401, verify your key in the console and try again.