| Variable | Value |
|---|---|
ANTHROPIC_BASE_URL | https://api.kie.ai/claude |
ANTHROPIC_API_KEY | Bearer <your kie.ai API Key> |
ANTHROPIC_AUTH_TOKEN | <your kie.ai API Key> (alternative to ANTHROPIC_API_KEY — no Bearer prefix needed) |
Important Notes Set ANTHROPIC_BASE_URLtohttps://api.kie.ai/claudeonly — do not append/v1/messages. Claude Code appends that automatically.There are two ways to provide your API Key — choose one: Option 1: Use ANTHROPIC_API_KEY. The value must start withBearer(note the space after Bearer). Example:Bearer sk-kie-abc123xxxOption 2: Use ANTHROPIC_AUTH_TOKEN. Set it directly to the Key value — no Bearer prefix. Example:sk-kie-abc123xxx
irm https://claude.ai/install.ps1 | iexclaude --version. If you see a version number, the installation succeeded.⚠️ If the claudecommand is not found, check that Claude Code was added to your PATH.⚠️ After installing, do not log in with an Anthropic account. You will connect using your kie.ai credentials in the next step.
# Option 1: ANTHROPIC_API_KEY (Bearer prefix required)
[Environment]::SetEnvironmentVariable("ANTHROPIC_BASE_URL", "https://api.kie.ai/claude", "User")
[Environment]::SetEnvironmentVariable("ANTHROPIC_API_KEY", "Bearer your_kie_API_Key", "User")# Option 2: ANTHROPIC_AUTH_TOKEN (no Bearer prefix)
[Environment]::SetEnvironmentVariable("ANTHROPIC_BASE_URL", "https://api.kie.ai/claude", "User")
[Environment]::SetEnvironmentVariable("ANTHROPIC_AUTH_TOKEN", "your_kie_API_Key", "User")claude. Does not affect other programs on your system — a cleaner option if you prefer isolation.~/.claude/settings.jsonC:\Users\<your-username>\.claude\settings.json// Option 1: ANTHROPIC_API_KEY (Bearer prefix required)
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.kie.ai/claude",
"ANTHROPIC_API_KEY": "Bearer your_kie_API_Key"
}
}// Option 2: ANTHROPIC_AUTH_TOKEN (no Bearer prefix)
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.kie.ai/claude",
"ANTHROPIC_AUTH_TOKEN": "your_kie_API_Key"
}
}https://github.com/farion1231/cc-switch/releases
| Symptom | Cause / Solution |
|---|---|
| Still prompted to log in with Anthropic account | Environment variables not loaded. Fully close all terminal windows (Mac: right-click Terminal → Quit; Windows: close all PowerShell processes) and reopen. |
401 Unauthorized error | API Key is wrong or expired. If using ANTHROPIC_API_KEY, confirm the Bearer prefix is present. If using ANTHROPIC_AUTH_TOKEN, set it to the raw Key with no prefix. Check your key in the kie.ai dashboard. |
model not found error | Inside Claude, run /model and switch to a model supported by kie.ai. |
| Windows — changes still not working | Close all terminals, including built-in terminals in VSCode, Cursor, and other editors. Fully quit those apps and relaunch. |
claude --debug and review the detailed logs..claude/settings.json to .gitignore. Files placed in your home directory (~/.claude/) are safe by default.