Connect Claude Code to Routescope
Use Claude Code with your Routescope API Key and quota through CC Switch or settings.json.
Point Claude Code to Routescope and run it with your Routescope API Key and quota.
This guide keeps only the most reliable setup paths. First-time users do not need to understand API protocols. Follow the steps and fill in the listed values.
Last updated: 2026-07-13
Choose a Setup Method
Choose one of the two methods below. New users should use method 1.
| Method | Best for | Difficulty | Manual config required |
|---|---|---|---|
| 1. CC Switch (recommended) | New users, users unfamiliar with terminals | Easiest | No |
| 2. Manual Claude Code CLI setup | Users comfortable copying commands and editing config files | Medium | Yes |
If you are not comfortable with the command line, use CC Switch graphical setup.
Claude Desktop and Claude Code are different applications. This page only covers Claude Code CLI setup. Do not mix it with Claude Desktop configuration.
Before You Start
Both setup methods require the following two items.
1. Routescope API Key
- Sign in to the Routescope console.
- Open Token Management.
- Click Add Token.
- Use a token name such as
Claude Code. - Configure quota, allowed models, IP restrictions, and expiration if needed.
- After saving, click Copy Access Code in the token list.
You will get a string that starts with sk-, for example:
sk-xxxxxxxxxxxxxxxxKeep the entire string, including the sk- prefix.
2. An Available Model ID
- Open Routescope Model Plaza.
- Find a model that your token is allowed to use.
- Copy the full model ID.
Do not copy only the display name, and do not blindly reuse model examples from other guides.
Fixed Values You Will Use
| Name | Value | Plain explanation |
|---|---|---|
| API Key | Your full sk-... | The passcode for Routescope |
| Model ID | A model allowed by your token | The model Claude Code will call |
| Base URL | https://api.routescope.ai | Routescope endpoint |
Do not add /v1 for Claude Code
Claude Code requests Anthropic-style API paths by itself. Enter only https://api.routescope.ai.
Protect your API Key
An API Key is like a password. Do not send it to others or include it in screenshots, chats, tickets, or public documents.
Method 1: Use CC Switch (Recommended)
CC Switch is a graphical configuration tool. You do not need to create settings.json manually.
For the full flow, see Connect CC Switch to Routescope.
Summary:
- Install and open CC Switch.
- Select Claude Code at the top.
- Click the + button in the upper-right corner.
- Choose Application-specific provider.
- Choose Custom configuration under preset providers.
- Enter the full API Key.
- Set API endpoint to
https://api.routescope.ai. - Keep API format as
Anthropic Messages (native). - Keep auth field as
ANTHROPIC_AUTH_TOKEN (default). - In Model Mapping, choose your prepared model and set the default fallback model.
- Save, then click Enable on the Routescope provider card.
After this, skip to How to Confirm It Works.
Claude Code itself must still be installed
CC Switch writes configuration, but it does not replace Claude Code. If your terminal cannot run claude, follow the install check in method 2.
Method 2: Manual Claude Code CLI Setup
This method requires opening a terminal and creating a configuration file. If that feels hard, switch to method 1.
Step 1: Check Whether Claude Code Is Installed
Open a terminal:
- Windows: search for and open PowerShell.
- macOS: open Applications -> Utilities -> Terminal.
- Linux: open your system terminal.
Run:
claude --versionIf you see a version number, continue.
If the command is not found, run the official installer for your system. In some regions, Claude's official installer may not be reachable. Before installing, make sure you can open claude.ai in your browser.
Windows PowerShell:
irm https://claude.ai/install.ps1 | iexmacOS, Linux, or WSL:
curl -fsSL https://claude.ai/install.sh | bashAfter installation, close the terminal, open a new one, and run:
claude --versionIf it still fails, see the official Claude Code setup guide.
Step 2: Open settings.json
Claude Code's user configuration file is named settings.json.
Windows
Run these in PowerShell:
New-Item -ItemType Directory -Force "$env:USERPROFILE\.claude"
notepad "$env:USERPROFILE\.claude\settings.json"If Notepad asks whether to create a new file, choose yes.
macOS
Run these in Terminal:
mkdir -p ~/.claude
touch ~/.claude/settings.json
open -e ~/.claude/settings.jsonThe file opens in TextEdit.
Linux
Run:
mkdir -p ~/.claude
nano ~/.claude/settings.jsonAfter pasting, press Ctrl + O to save, press Enter to confirm, then press Ctrl + X to exit.
Do not overwrite existing config blindly
If settings.json already contains settings you do not understand, do not replace the whole file. New users should use CC Switch. Users familiar with JSON can merge the next step into the existing env object.
Step 3: Paste the Configuration
If this is a new file, paste the full content below:
{
"env": {
"ANTHROPIC_AUTH_TOKEN": "paste-your-full-sk-secret-here",
"ANTHROPIC_BASE_URL": "https://api.routescope.ai",
"ANTHROPIC_MODEL": "paste-model-id-here",
"ANTHROPIC_CUSTOM_MODEL_OPTION": "paste-model-id-here",
"ANTHROPIC_CUSTOM_MODEL_OPTION_NAME": "Routescope Model",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "paste-model-id-here",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "paste-model-id-here",
"ANTHROPIC_DEFAULT_FABLE_MODEL": "paste-model-id-here",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "paste-model-id-here"
}
}Replace only two kinds of values:
- Replace
paste-your-full-sk-secret-herewith your full API Key. - Replace every
paste-model-id-herewith the same real model ID.
For first-time setup, using the same model for every model role is the least error-prone. After confirming that your token can use multiple models, you can split the roles.
Do not change:
https://api.routescope.aiCheck:
- The file is named
settings.json, notsettings.json.txt. - The API Key keeps the
sk-prefix. - The Base URL does not end with
/v1. - Every model placeholder has been replaced.
- You did not remove quotes, commas, or braces.
Save and close the file.
Step 4: Start Claude Code
Close the previous terminal, open a new one, and run:
claudeNormally, this opens the Claude Code chat interface.
If it still opens the official sign-in page:
- Exit Claude Code.
- Check that the
settings.jsonpath is correct. - Check that the file was not saved as
settings.json.txt. - Open a new terminal and run
claudeagain.
Step 5: Choose the Model
Inside Claude Code, run:
/modelChoose:
Routescope ModelIf you do not see "Routescope Model":
- Exit Claude Code.
- Check that
ANTHROPIC_CUSTOM_MODEL_OPTIONcontains the real model ID. - Check that the JSON has no missing commas or quotes.
- Save and restart Claude Code.
How to Confirm It Works
Asking the AI to say "I am connected to Routescope" is not enough. It may only repeat your words.
Confirm it this way:
-
Send a normal question in Claude Code, for example:
Describe yourself in one sentence. -
After receiving a response, open the Routescope console.
-
Go to Operation Records or Call Records.
-
Find a new record from the same time.
-
Confirm the call status is successful.
-
Confirm the model, token usage, and billing look normal.
Claude Code is truly connected only when Claude Code replies normally and Routescope shows the corresponding successful request.
Troubleshooting
401 or 403
This is usually a key or token permission issue. Check:
- The API Key is complete.
- The
sk-prefix is present. - The token is not disabled, expired, or out of quota.
- The model is allowed by the token.
- IP restrictions are not blocking the request.
After changes, exit and restart Claude Code.
404
Confirm the configuration contains:
"ANTHROPIC_BASE_URL": "https://api.routescope.ai"Do not use:
https://api.routescope.ai/v1Claude Code will request /v1/messages by itself.
model not found
The model ID does not exist, or your token is not allowed to use it.
- Return to Routescope Model Plaza.
- Copy the full model ID allowed by your token.
- Replace every model field in
settings.json. - Save and restart Claude Code.
/model Does Not Show "Routescope Model"
- Check
ANTHROPIC_CUSTOM_MODEL_OPTION. - Check
ANTHROPIC_CUSTOM_MODEL_OPTION_NAME. - Confirm the file is saved.
- Fully exit and restart Claude Code.
JSON Configuration Error
Check:
- Use straight double quotes
". - Use commas
,between entries. - Do not add a trailing comma after the last entry.
- Braces are paired.
- The file is really named
settings.json.
If you cannot tell what is wrong, copy the full configuration from this page again and replace only the key and model ID.
Extra inputs are not permitted
If the error includes:
context_management: Extra inputs are not permittedor the gateway says it does not accept anthropic-beta, add this under env:
"CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS": "1"For example, add a comma after the previous model field and then add:
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "your-real-model-id",
"CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS": "1"Save and restart Claude Code. If you never see this error, you do not need this setting.
The AI Replies, but Routescope Has No Operation Record
This usually means Claude Code is not using the Routescope configuration.
- Confirm the Base URL is
https://api.routescope.ai. - Confirm Claude Code was restarted after configuration changes.
- If using CC Switch, confirm the Routescope card is active/current.
- Send another request and refresh Operation Records.
The Command Line Is Still Too Hard
Stop editing environment variables or config files and switch to CC Switch graphical setup.
Other Setup Options
The methods below are for users familiar with terminals. New users should use CC Switch or settings.json.
Temporary Environment Variables
These variables only apply to the current terminal and disappear after closing it.
Windows PowerShell:
$env:ANTHROPIC_AUTH_TOKEN="sk-your-full-secret"
$env:ANTHROPIC_BASE_URL="https://api.routescope.ai"
$env:ANTHROPIC_MODEL="your-real-model-id"
claudemacOS, Linux, or WSL:
export ANTHROPIC_AUTH_TOKEN="sk-your-full-secret"
export ANTHROPIC_BASE_URL="https://api.routescope.ai"
export ANTHROPIC_MODEL="your-real-model-id"
claudeAdvanced: Models and Experimental Betas
Most users can skip this section after setup succeeds.
Model Roles
| Setting | Purpose |
|---|---|
ANTHROPIC_MODEL | Default model |
ANTHROPIC_DEFAULT_SONNET_MODEL | Sonnet role model |
ANTHROPIC_DEFAULT_OPUS_MODEL | Opus role model |
ANTHROPIC_DEFAULT_FABLE_MODEL | Fable role model |
ANTHROPIC_DEFAULT_HAIKU_MODEL | Haiku and some background task model |
ANTHROPIC_CUSTOM_MODEL_OPTION | Adds a custom model to /model |
ANTHROPIC_CUSTOM_MODEL_OPTION_NAME | Menu name for the custom model |
Only set different models after confirming your token can access multiple models.
experimental betas
CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 handles cases where the gateway does not support certain beta headers or beta tool fields.
It may disable some experimental capabilities, so use it only when you see a related error.
Third-Party Gateway Differences
When ANTHROPIC_BASE_URL points to a third-party gateway:
- MCP Tool Search is disabled by default.
- Remote Control is unavailable.
- Beta capability support depends on the gateway and upstream model.
Only enable advanced capabilities after Routescope confirms support.
References
Last updated on