Routim documentation
Connect a coding client or make your first API request with a Routim key.
Get an API keyConnect a coding client or make your first API request with a Routim key.
Get an API keyInstall 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.
{
"env": {
"ANTHROPIC_BASE_URL": "https://api2.rout.im",
"ANTHROPIC_AUTH_TOKEN": "YOUR_ROUTIM_API_KEY"
}
}
Clear any previously configured ANTHROPIC_API_KEY from this profile and the shell, then start Claude Code with a model ID you can access.
claude --model MODEL_ID
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.
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
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.
{
"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"
}
}
}
}
}
Open Claude Desktop. In the macOS menu bar, open Help → Troubleshooting → Enable Developer Mode.
Open Claude Desktop. In the application menu (☰), open Help → Troubleshooting → Enable Developer Mode.
Install Claude Desktop for Linux (beta). Open the application menu (☰) and choose Help → Troubleshooting → Enable Developer Mode.
routim.json and replace YOUR_ROUTIM_API_KEY with your key.{
"deploymentDisplayName": "Routim",
"inferenceProvider": "gateway",
"inferenceGatewayBaseUrl": "https://api2.rout.im",
"inferenceGatewayApiKey": "YOUR_ROUTIM_API_KEY",
"inferenceGatewayAuthScheme": "bearer"
}
Sign in to the Routim console and create an API key.
https://api2.rout.im/v1
Send your personal V2 API key as a Bearer token. For team keys, use the team endpoint.
Authorization: Bearer YOUR_ROUTIM_API_KEY
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.
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.
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.
printf "Routim API key: "; IFS= read -r -s ROUTIM_API_KEY; printf "\n"
export ROUTIM_API_KEY
$env:ROUTIM_API_KEY = Read-Host "Routim API key" -MaskInput
curl --fail-with-body "https://api2.rout.im/v1/models" \
-H "Authorization: Bearer $ROUTIM_API_KEY"
Replace MODEL_ID with a Claude model ID from your model list.
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.