Claude Code Setup
Welcome to ShenwenAI. You can connect Claude Code to our API without deleting your existing Claude Code login, and switch back any time after testing.
For the lowest-risk setup, set environment variables only in the current terminal instead of writing them into ~/.zshrc or ~/.bashrc.
Copy these model IDs into config files, API request bodies, or any OpenAI-compatible client that asks for a model name.
Prepare your API key first
After logging in, create or copy an API key from your account page. It looks like sk-or-v1-xxxxxxxxxxxx. Treat it like a password.
Go to account pageClaude Code uses this Base URL. Do not append /v1.
Do not share your API key with others or commit it to GitHub, GitLab, or any public repository.
The commands below will switch based on your selected system.
Install Claude Code
Run this only if Claude Code is not installed yet.
npm install -g @anthropic-ai/claude-codeSet environment variables
Replace sk-or-v1-your-key with your own ShenwenAI API key.
unset ANTHROPIC_API_KEY
export ANTHROPIC_BASE_URL="https://api.shenwenai.com"
export ANTHROPIC_AUTH_TOKEN="sk-or-v1-your-key"Use ANTHROPIC_AUTH_TOKEN, not ANTHROPIC_API_KEY.
Start using it
Run claude in your project folder. After entering Claude Code, use /status to confirm that the Base URL points to ShenwenAI.
If Claude Code shows the model as opus 4.8, you can ignore it for now. The backend will use ShenwenAI model routing.
GPT-5.6 Sol, Terra, and Luna support about 1.05M input context. When input plus cached input exceeds 272K tokens, the entire request is billed at long-context rates. Claude Code automatic routing may still select another supported model based on the task and upstream availability.
claudeSwitch back to your own Claude Code account
ANTHROPIC_AUTH_TOKEN takes priority over the /login subscription account, so setting it routes requests through ShenwenAI API. Your original login is not removed.
To switch back, unset the environment variables or open a new terminal.
unset ANTHROPIC_BASE_URL ANTHROPIC_AUTH_TOKEN