Routescope APIRoutescope API

Claude Code

Claude Code integration guide for Routescope

Keep these values handy

Claude Code uses an Anthropic-style integration. The three key values are:

  • ANTHROPIC_AUTH_TOKEN: the full sk-... key copied from the console
  • ANTHROPIC_BASE_URL: https://api.routescope.ai
  • Model selection: choose the model after launch with /model

Step 1: Create a key in Routescope

  1. Sign in to Routescope.
  2. Open Token Management in the console.
  3. Click Add Token and save it.
  4. In the token list, click Copy Secret to get the full sk-... value.

Important

When integrating Claude Code, always use the full secret directly. Do not remove the sk- prefix.

Step 2: Configure the parameters

Claude Code fieldValueNotes
ANTHROPIC_AUTH_TOKENsk-...Claude Code sends this as Authorization: Bearer ...
ANTHROPIC_BASE_URLhttps://api.routescope.aiUse the API root URL here. Do not add /v1
/modelChoose a model available to your accountSelect it after Claude Code launches
ANTHROPIC_CUSTOM_MODEL_OPTIONOptionalOnly use this when you need to manually add a gateway model entry

Step 3: Set it up in Claude Code

The most common Claude Code setup uses environment variables.

Run this directly in PowerShell:

setx ANTHROPIC_AUTH_TOKEN "sk-your-token"
setx ANTHROPIC_BASE_URL "https://api.routescope.ai"

After running it, close the current terminal, reopen PowerShell, and then start claude.

Add the following to your shell config file, such as ~/.zshrc or ~/.bashrc:

export ANTHROPIC_AUTH_TOKEN="sk-your-token"
export ANTHROPIC_BASE_URL="https://api.routescope.ai"

Then run:

source ~/.zshrc

If you use bash, run this instead:

source ~/.bashrc

Step 4: Launch Claude Code and choose a model

Start Claude Code first:

claude

Then run this inside Claude Code:

/model

Then follow this logic:

  1. If the model or alias you want is already listed, select it directly
  2. If your gateway model is not listed but it supports Anthropic-style calls, add a custom model entry

Optional example:

setx ANTHROPIC_CUSTOM_MODEL_OPTION "claude-sonnet-4-5"
setx ANTHROPIC_CUSTOM_MODEL_OPTION_NAME "Sonnet via Routescope"
export ANTHROPIC_CUSTOM_MODEL_OPTION="claude-sonnet-4-5"
export ANTHROPIC_CUSTOM_MODEL_OPTION_NAME="Sonnet via Routescope"

If you are not sure about the exact model ID, skip ANTHROPIC_CUSTOM_MODEL_OPTION for now and use /model to see what is currently available.

Step 5: Verify the setup

The simplest verification is to send a short prompt after launch:

Reply with "Claude Code is connected to Routescope", then list the top-level directories in the current project.

If it returns normally, the request path is working.

FAQ

Why does ANTHROPIC_BASE_URL use the root domain instead of /v1

Claude Code uses Anthropic-style endpoints and builds the request path itself. Use the gateway root URL here and do not change it to https://api.routescope.ai/v1.

Why am I getting 401 or 403

Check these first:

  1. Whether ANTHROPIC_AUTH_TOKEN contains the full sk-... secret
  2. Whether the token is disabled, expired, or out of balance
  3. Whether the model selected in /model is allowed for that token
  4. Whether an IP restriction is blocking the request

Why do I see ERR_BAD_REQUEST with context_management: Extra inputs are not permitted

If you see this at the top:

Unable to connect to Anthropic services
Failed to connect to api.anthropic.com: ERR_BAD_REQUEST

And also see an error like this at the bottom:

API Error: 400
Provider API error: context_management: Extra inputs are not permitted

This usually does not mean the key is wrong. In many cases, Claude Code experimental betas are sending an extra context_management field, and some gateways or upstream providers do not currently accept it.

When debugging, focus on the bottom 400 error first. The top message, Unable to connect to Anthropic services, is often just Claude Code's generic wording. It does not necessarily mean you are connecting directly to api.anthropic.com, and it is not always a plain network issue.

The recommended fix is to disable experimental betas in Claude Code settings:

Edit or create:

~/.claude/settings.json

Edit or create:

C:\Users\your-username\.claude\settings.json

Add the following:

{
  "env": {
    "CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS": "1"
  }
}

After saving, close the terminal, open a new one, run claude again, and verify with a simple prompt.

If the problem is only a Base URL, API key, or model permission issue, you are more likely to see 401, 403, or 404 rather than this type of validation-related 400.

Why isn't the model I want listed in /model

First confirm that your account actually has access to the model. If the gateway model is not in Claude Code's built-in list but the endpoint supports it, you can add it manually with ANTHROPIC_CUSTOM_MODEL_OPTION.

Last updated on