Routescope APIRoutescope API
Client Tool Setup

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.

MethodBest forDifficultyManual config required
1. CC Switch (recommended)New users, users unfamiliar with terminalsEasiestNo
2. Manual Claude Code CLI setupUsers comfortable copying commands and editing config filesMediumYes

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

  1. Sign in to the Routescope console.
  2. Open Token Management.
  3. Click Add Token.
  4. Use a token name such as Claude Code.
  5. Configure quota, allowed models, IP restrictions, and expiration if needed.
  6. After saving, click Copy Access Code in the token list.

You will get a string that starts with sk-, for example:

sk-xxxxxxxxxxxxxxxx

Keep the entire string, including the sk- prefix.

2. An Available Model ID

  1. Open Routescope Model Plaza.
  2. Find a model that your token is allowed to use.
  3. 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

NameValuePlain explanation
API KeyYour full sk-...The passcode for Routescope
Model IDA model allowed by your tokenThe model Claude Code will call
Base URLhttps://api.routescope.aiRoutescope 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.

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:

  1. Install and open CC Switch.
  2. Select Claude Code at the top.
  3. Click the + button in the upper-right corner.
  4. Choose Application-specific provider.
  5. Choose Custom configuration under preset providers.
  6. Enter the full API Key.
  7. Set API endpoint to https://api.routescope.ai.
  8. Keep API format as Anthropic Messages (native).
  9. Keep auth field as ANTHROPIC_AUTH_TOKEN (default).
  10. In Model Mapping, choose your prepared model and set the default fallback model.
  11. 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 --version

If 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 | iex

macOS, Linux, or WSL:

curl -fsSL https://claude.ai/install.sh | bash

After installation, close the terminal, open a new one, and run:

claude --version

If 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.json

The file opens in TextEdit.

Linux

Run:

mkdir -p ~/.claude
nano ~/.claude/settings.json

After 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:

  1. Replace paste-your-full-sk-secret-here with your full API Key.
  2. Replace every paste-model-id-here with 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.ai

Check:

  • The file is named settings.json, not settings.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:

claude

Normally, this opens the Claude Code chat interface.

If it still opens the official sign-in page:

  1. Exit Claude Code.
  2. Check that the settings.json path is correct.
  3. Check that the file was not saved as settings.json.txt.
  4. Open a new terminal and run claude again.

Step 5: Choose the Model

Inside Claude Code, run:

/model

Choose:

Routescope Model

If you do not see "Routescope Model":

  1. Exit Claude Code.
  2. Check that ANTHROPIC_CUSTOM_MODEL_OPTION contains the real model ID.
  3. Check that the JSON has no missing commas or quotes.
  4. 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:

  1. Send a normal question in Claude Code, for example:

    Describe yourself in one sentence.
  2. After receiving a response, open the Routescope console.

  3. Go to Operation Records or Call Records.

  4. Find a new record from the same time.

  5. Confirm the call status is successful.

  6. 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:

  1. The API Key is complete.
  2. The sk- prefix is present.
  3. The token is not disabled, expired, or out of quota.
  4. The model is allowed by the token.
  5. 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/v1

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

  1. Return to Routescope Model Plaza.
  2. Copy the full model ID allowed by your token.
  3. Replace every model field in settings.json.
  4. Save and restart Claude Code.

/model Does Not Show "Routescope Model"

  1. Check ANTHROPIC_CUSTOM_MODEL_OPTION.
  2. Check ANTHROPIC_CUSTOM_MODEL_OPTION_NAME.
  3. Confirm the file is saved.
  4. 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 permitted

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

  1. Confirm the Base URL is https://api.routescope.ai.
  2. Confirm Claude Code was restarted after configuration changes.
  3. If using CC Switch, confirm the Routescope card is active/current.
  4. 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"
claude

macOS, 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"
claude

Advanced: Models and Experimental Betas

Most users can skip this section after setup succeeds.

Model Roles

SettingPurpose
ANTHROPIC_MODELDefault model
ANTHROPIC_DEFAULT_SONNET_MODELSonnet role model
ANTHROPIC_DEFAULT_OPUS_MODELOpus role model
ANTHROPIC_DEFAULT_FABLE_MODELFable role model
ANTHROPIC_DEFAULT_HAIKU_MODELHaiku and some background task model
ANTHROPIC_CUSTOM_MODEL_OPTIONAdds a custom model to /model
ANTHROPIC_CUSTOM_MODEL_OPTION_NAMEMenu 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