Configuring Claude Code in CC Switch
This guide walks you through adding RKAPI as a Claude Code provider in CC Switch, verifying the generated ~/.claude/settings.json file, and confirming live requests in your terminal.
Prerequisites
- Claude Code installed locally (see Environment Preparation and Claude Code if you have not installed it yet).
- CC Switch installed (see CC Switch Overview).
- An RKAPI API key (
sk-...) created at https://s2pbxm0xv5y.adtyai-fz.top with access to Claude models. - No conflicting
ANTHROPIC_*shell environment variables (see Common Configuration).
Step 1: Add an RKAPI Provider for Claude Code
- Launch CC Switch and select the Claude Code tab in the top navigation bar.
- Click Add Provider (
+) and choose Custom (or the Anthropic-compatible template). - Enter the following settings:
| Field | Value | Notes |
|---|---|---|
| Provider Name | RKAPI | Or a specific label such as RKAPI - Claude |
API Base URL (ANTHROPIC_BASE_URL) | https://api.zwwbai.com | Do NOT add /v1 at the end |
API Key (ANTHROPIC_AUTH_TOKEN) | sk-your-api-key | Paste your full API key from RKAPI |
Default Model (ANTHROPIC_MODEL) | claude-sonnet-4-6 | Check active model IDs at https://s2pbxm0xv5y.adtyai-fz.top/pricing |
Fast / Small Model (ANTHROPIC_SMALL_FAST_MODEL) | claude-haiku-4-5-20251001 | Optional; used for quick background tasks |
Never Append /v1 to the Claude Base URL
Claude Code automatically appends /v1/messages to ANTHROPIC_BASE_URL. Setting the URL to https://api.zwwbai.com/v1 produces /v1/v1/messages and fails with HTTP 404. Always use https://api.zwwbai.com.
Step 2: Review the Generated settings.json
CC Switch provides a JSON preview editor before saving. Your RKAPI Claude Code profile should render cleanly to a configuration equivalent to the following:
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.zwwbai.com",
"ANTHROPIC_AUTH_TOKEN": "sk-your-api-key",
"ANTHROPIC_MODEL": "claude-sonnet-4-6",
"ANTHROPIC_SMALL_FAST_MODEL": "claude-haiku-4-5-20251001",
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
}
}When activated, CC Switch writes this JSON to Claude Code's user configuration path:
- macOS / Linux:
~/.claude/settings.json - Windows:
%USERPROFILE%\.claude\settings.json
Optional Model Overrides
You can leave ANTHROPIC_MODEL and ANTHROPIC_SMALL_FAST_MODEL unset if you prefer switching models interactively inside Claude Code using /model, or pin specific model IDs per CC Switch profile (for example, one profile pinned to claude-opus-4-6 for architecture reviews and another pinned to claude-sonnet-4-6 for daily coding).
Step 3: Activate the Profile
- Click Save to store the
RKAPIprovider in CC Switch. - Click Enable / Switch on the
RKAPIcard so it becomes the active Claude Code provider. - Confirm the file on disk was updated:
macOS / Linux:
cat ~/.claude/settings.jsonWindows PowerShell:
Get-Content "$env:USERPROFILE\.claude\settings.json"Step 4: Test in Your Terminal
Open a new terminal window inside any project directory and start Claude Code:
claudeInside the interactive session:
- Run
/statusto verify Claude Code seeshttps://api.zwwbai.comas its API base URL and reports no authentication warnings. - Send a short test prompt (for example:
Reply with OK and the model you are running.). - Visit https://s2pbxm0xv5y.adtyai-fz.top/usage-logs to confirm the request logged under your API key with token usage details.
Switching Between Multiple Profiles
If you maintain separate RKAPI profiles (such as personal vs. team keys or different channel groups):
- Click the target profile in CC Switch's Claude Code tab.
- Exit any running
claudesession (/exit) and relaunchclaudeso the process loads the updated~/.claude/settings.json.
Troubleshooting & Further Optimization
- Claude Code still prompts for an Anthropic account login: Check whether stale
ANTHROPIC_API_KEYorANTHROPIC_BASE_URLenvironment variables exist in your shell, or verify~/.claude.jsononboarding state. See Claude Code FAQ. - HTTP
403error: You likely enteredhttps://s2pbxm0xv5y.adtyai-fz.topinstead ofhttps://api.zwwbai.com. - HTTP
404error: Check thatANTHROPIC_BASE_URLdoes not end with/v1. - Low prompt cache hit rate: Review Claude Code Cache Fix to maximize prompt caching efficiency on long coding sessions.
- Want to route ChatGPT or DeepSeek models through Claude Code? See ChatGPT via Claude Code and DeepSeek via Claude Code.