Claude Code
Claude Code integration guide for Tokaify
Keep these values handy
Claude Code uses an Anthropic-style integration. The three key values are:
ANTHROPIC_API_KEY: the fullsk-...key copied from the consoleANTHROPIC_BASE_URL:https://api.tokaify.com- Model selection: choose the model after launch with
/model
Step 1: Create a key in Tokaify
- Sign in to Tokaify.
- Open Token Management in the console.
- Click
Add Tokenand save it. - In the token list, click
Copy Secretto get the fullsk-...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 field | Value | Notes |
|---|---|---|
ANTHROPIC_API_KEY | sk-... | Claude Code sends this as X-Api-Key |
ANTHROPIC_BASE_URL | https://api.tokaify.com | Use the API root URL here. Do not add /v1 |
/model | Choose a model available to your account | Select it after Claude Code launches |
ANTHROPIC_CUSTOM_MODEL_OPTION | Optional | Only 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_API_KEY "sk-your-token"
setx ANTHROPIC_BASE_URL "https://api.tokaify.com"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_API_KEY="sk-your-token"
export ANTHROPIC_BASE_URL="https://api.tokaify.com"Then run:
source ~/.zshrcIf you use bash, run this instead:
source ~/.bashrcStep 4: Launch Claude Code and choose a model
Start Claude Code first:
claudeThen run this inside Claude Code:
/modelThen follow this logic:
- If the model or alias you want is already listed, select it directly
- 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 Tokaify"export ANTHROPIC_CUSTOM_MODEL_OPTION="claude-sonnet-4-5"
export ANTHROPIC_CUSTOM_MODEL_OPTION_NAME="Sonnet via Tokaify"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 Tokaify", 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.tokaify.com/v1.
Why am I getting 401 or 403
Check these first:
- Whether
ANTHROPIC_API_KEYcontains the fullsk-...secret - Whether the token is disabled, expired, or out of balance
- Whether the model selected in
/modelis allowed for that token - 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_REQUESTAnd also see an error like this at the bottom:
API Error: 400
Provider API error: context_management: Extra inputs are not permittedThis 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.jsonEdit or create:
C:\Users\your-username\.claude\settings.jsonAdd 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.
How is this guide?
Last updated on