Claude Code with 9Coding
Claude Code supports custom endpoints natively. Set two environment variables and the Claude Code in your terminal switches from the official channel to 9Coding — identical workflow, one key for every model.
Step 1 · Get a key
Create an API key in the 9Coding console; keys start with sk-9c-. If you don't have an account yet, sign up first — you can create a key immediately after.
Step 2 · Change the endpoint
On macOS or Linux, add these to ~/.zshrc or ~/.bashrc:
~/.zshrc
export ANTHROPIC_BASE_URL="https://api.9coding.com"
export ANTHROPIC_AUTH_TOKEN="sk-9c-your-key"
On Windows (PowerShell):
PowerShell
[Environment]::SetEnvironmentVariable("ANTHROPIC_BASE_URL", "https://api.9coding.com", "User")
[Environment]::SetEnvironmentVariable("ANTHROPIC_AUTH_TOKEN", "sk-9c-your-key", "User")
Already signed in to an official account? Environment variables take precedence, so the switch happens as soon as you open a new terminal. Unset the two variables and you're back on the official channel.
Step 3 · Verify the connection
terminal
# after reopening the terminal, or running source ~/.zshrc
claude
# ask anything, then check the console Logs page for the call
Choosing a model
The /model command works as usual — Opus, Fable and Sonnet are all available from the same key, with nothing gated. Every call draws on your balance at the official price list, and the balance never expires, so there is no daily cap to run into mid-task.
Troubleshooting
- 401 — the key was truncated when copied, or the variables haven't taken effect. Reopen the terminal and retry.
- 429 — you've hit the concurrency limit. Wait a few seconds and retry.
- Once connected: see the setup guide to turn "ask every step" into "ask less, do more".
- Switching back temporarily —
unset ANTHROPIC_BASE_URL ANTHROPIC_AUTH_TOKEN. - Any other error — use the pages for connection errors, missing models or context limits.