Claude Code
Claude Code is Anthropic’s official coding agent. By integrating it with ShuYou, you gain access to a much wider range of models—not just Anthropic’s Claude lineup.For example, through ShuYou you can use GPT, Claude, Gemini, and other models that support the Anthropic Messages protocol directly inside Claude Code. For the full list, see the ShuYou model list.ShuYou fully supports the Anthropic Messages API, so it integrates seamlessly into tools like Claude Code and Cursor. Just change two parameters to get started.Anthropic protocol base URL:
https://api.shuyou.aiConfiguration
Installing Claude Code
Recommended installation (native install):- macOS / Linux / WSL
- Windows PowerShell
- Windows CMD
- Homebrew (macOS)
- WinGet (Windows)
- Native install (recommended): Script-based installs for macOS/Linux/WSL and Windows auto-update.
- Package manager install: Homebrew and WinGet require manual upgrade commands.
- Full installation docs: See the official Claude Code installation docs.
- Verify the install: After installation, run
claude doctor.
Configuring Claude Code
How the configuration works
By default, Claude Code connects directly to Anthropic’s official service. By setting a few environment variables, we can redirect its requests to ShuYou instead. The benefits are:- No changes to Claude Code itself: You switch the service endpoint purely through environment variables.
- Authenticate with a ShuYou API Key: Used in place of an official Anthropic API Key.
- Access more models: Beyond the Claude series, you can also use GPT, Gemini, and other Anthropic-compatible models on ShuYou.
ANTHROPIC_BASE_URL (https://api.shuyou.ai) and ANTHROPIC_AUTH_TOKEN (your ShuYou API Key). Together they route all of Claude Code’s requests through ShuYou.
Step 0: Get a ShuYou API Key
Before configuring Claude Code, you need a ShuYou API Key. ShuYou offers two billing plans—choose based on your use case:- Subscription API Key (recommended)
- Pay As You Go API Key
Best for: personal development, learning, vibe codingHighlights: fixed monthly fee, predictable costHow to get it:
- Go to Subscription management
- Choose a plan that fits your needs
- After subscribing, create a subscription API Key on the page
Step 1: Configure shell environment variables (recommended)
This step writes the ShuYou connection settings into your shell config file so they take effect automatically every time you open a terminal.- macOS / Linux
- Windows PowerShell
| Variable | Required | Purpose | Description |
|---|---|---|---|
ANTHROPIC_BASE_URL | Yes | Service endpoint | Redirects Claude Code’s requests to ShuYou |
ANTHROPIC_AUTH_TOKEN | Yes | Authentication key | Your ShuYou API Key |
ANTHROPIC_API_KEY | Yes | Conflict avoidance | Set to "" to avoid conflicts with an existing Anthropic config |
CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS | Recommended | Performance | Disables experimental beta features to avoid long routing |
CLAUDE_CODE_ATTRIBUTION_HEADER | Recommended | Performance | Turns off the attribution header |
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC | Recommended | Traffic control | Disables non-essential reporting |
API_TIMEOUT_MS | Optional | API timeout | Request timeout in milliseconds |
ANTHROPIC_DEFAULT_*_MODEL | Optional | Model mapping | Haiku/Sonnet/Opus tiers; leave unset for Claude Code defaults |
Step 2: Launch Claude Code and authenticate
Once the environment variables are set, you can start Claude Code. On first launch, it authenticates automatically through ShuYou.- Open a new terminal window (to ensure environment variables are loaded).
- Go to your project directory:
- Launch Claude Code:
- On first launch, Claude Code will:
- Automatically read
ANTHROPIC_AUTH_TOKENfrom the environment variables - Authenticate via the ShuYou service pointed to by
ANTHROPIC_BASE_URL - Be ready to use with no extra login steps
- Automatically read
Step 3: Verify the connection
At the Claude Code prompt, type the/status command:
Auth tokenshould show asANTHROPIC_AUTH_TOKENAnthropic base URLshould show ashttps://api.shuyou.ai
Changing / specifying the default model
Configuring a default model is optional. If you don’t setANTHROPIC_DEFAULT_*_MODEL, Claude Code uses its built-in default models.
Using official Claude models (recommended: aliases)
For official Claude models, we recommend the Claude model alias form (e.g.,claude-opus-4-7, claude-sonnet-4-6, claude-haiku-4-5) rather than the full ShuYou model slug (anthropic/claude-sonnet-4.5):
Claude Code validates model names against hardcoded strings to enable features like the 1M context window and effort-based reasoning control. When the validator sees
claude-sonnet-4-6, those features are activated; when it sees anthropic/claude-sonnet-4.5, validation may fail and features silently break.Use the alias form when available on the model detail page; otherwise use the full slug from the model list.Using non-Claude models
When switching to a non-Claude model (such as GPT or Gemini), use the full ShuYou model slug:source ~/.bashrc / source ~/.zshrc or restart your terminal. Switch models interactively with /model.
Supported models
Support for the Anthropic protocol is being rolled out in batches. Filter Anthropic API Compatible on the ShuYou model list:
You can also check on a model detail page:
You can also check on a model detail page:
Using the Claude Code extension in VSCode
In addition to the command-line version, Claude Code offers a VSCode extension for AI-assisted coding inside the editor.Step 1: Install the Claude Code extension
Search for and install Claude Code in the VSCode marketplace.Step 2: Open the settings
After installation, click the extension’s settings icon, then choose Edit in settings.json.Step 3: Configure the model and environment variables
Step 4: Start using it
- Click the Claude Code icon in the VSCode sidebar.
- Enter your question or task in the chat interface.
- Trust the workspace when prompted (Trust This Folder).
Troubleshooting
API Key error or authentication failure
API Key error or authentication failure
Problem: API Key invalid, unauthorized, or authentication failed.Solution:
- Verify the API Key is valid in the ShuYou console.
- Check subscription quota or Pay As You Go balance.
- Confirm environment variables are loaded:
- Confirm the API Key is enabled and not deleted.
Authentication fails when switching to ShuYou from another platform
Authentication fails when switching to ShuYou from another platform
Problem: Previously used official Claude Code or another platform; switching to ShuYou causes conflicts.Solution:
- Delete the old config file:
- Re-apply the ShuYou shell environment variables from Step 1.
- Reload:
source ~/.zshrcor. $PROFILE - Verify:
- Restart Claude Code and run
/status.
Model doesn't support the Anthropic protocol
Model doesn't support the Anthropic protocol
Filter Anthropic API Compatible on the ShuYou model list, or check each model’s detail page.
Connection failures
Connection failures
- Check network connectivity.
- Verify
ANTHROPIC_BASE_URLishttps://api.shuyou.ai. - Confirm firewall is not blocking outbound connections.
VSCode Claude Code extension configuration issues
VSCode Claude Code extension configuration issues
- Open VSCode settings → search “Claude Code” → Edit in settings.json.
- Confirm
claudeCode.environmentVariablescontains correctANTHROPIC_BASE_URLandANTHROPIC_AUTH_TOKEN. - For Claude models use alias form (e.g.
claude-sonnet-4-6); for others use full ShuYou slug. - Fully restart VSCode after changes.
- Check View → Output → Claude Code for errors.
- Run
/statusin the extension chat.
Windows PowerShell script execution policy issue
Windows PowerShell script execution policy issue
Run PowerShell as Administrator:Enter
Y, then reopen PowerShell.How to enable the 1M context window
How to enable the 1M context window
Cause: Claude Code validates model names against hardcoded strings. IDs with the Reload shell config and restart Claude Code.
anthropic/ prefix may not enable 1M context.Solution: Use alias form:What to do if Opus 4.7 won't work
What to do if Opus 4.7 won't work
- Upgrade Claude Code to the latest version (Opus 4.7 requires v2.1.111+). Run
claude --version. - Set
export ANTHROPIC_DEFAULT_OPUS_MODEL="claude-opus-4-7", or removeANTHROPIC_DEFAULT_*_MODELto use defaults. - Reload config and restart Claude Code.
See the ShuYou model list for all available models.