Appearance
Claude Code
Claude Code is a command-line AI coding assistant developed by Anthropic. Connect it to Alibaba Cloud Model Studio using Pay-as-you-go, Coding Plan, or Token Plan (Team Edition).
Install Claude Code
Install
macOS
Install or update Node.js (v18.0 or later).
Run the following command to install Claude Code.
HELPCODEESCAPE-bash npm install -g @anthropic-ai/claude-codeVerify the installation. A version number in the output confirms success.
HELPCODEESCAPE-bash claude --version
Windows
To use Claude Code on Windows, install WSL or Git for Windows, then run the following command in WSL or Git Bash.
HELPCODEESCAPE-bash
npm install -g @anthropic-ai/claude-codeFor more details, see the Windows setup guide in the official Claude Code documentation.
Skip login verification
Edit or create ~/.claude.json (Windows path: C:\Users<username>\.claude.json), and set hasCompletedOnboarding to true to skip the official Anthropic login verification.
HELPCODEESCAPE-json
{
"hasCompletedOnboarding": true
}Configure access credentials
Create ~/.claude/settings.json (Windows path: C:\Users<username>\.claude\settings.json) and add the configuration for your billing plan.
Token Plan (Team Edition)
Replace YOUR_API_KEY with the Token Plan (Team Edition) dedicated API Key. For available models, see supported models for Token Plan (Team Edition).
HELPCODEESCAPE-json
{
"env": {
"ANTHROPIC_AUTH_TOKEN": "YOUR_API_KEY",
"ANTHROPIC_BASE_URL": "https://token-plan.ap-southeast-1.maas.aliyuncs.com/apps/anthropic",
"ANTHROPIC_MODEL": "qwen3.6-plus",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "qwen3.6-flash",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "qwen3.6-plus",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "qwen3.6-plus",
"CLAUDE_CODE_SUBAGENT_MODEL": "qwen3.6-plus"
}
}Coding Plan
Replace YOUR_API_KEY with the Coding Plan dedicated API Key. For available models, see supported models for Coding Plan.
HELPCODEESCAPE-json
{
"env": {
"ANTHROPIC_AUTH_TOKEN": "YOUR_API_KEY",
"ANTHROPIC_BASE_URL": "https://coding-intl.dashscope.aliyuncs.com/apps/anthropic",
"ANTHROPIC_MODEL": "qwen3.6-plus",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "qwen3.6-plus",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "qwen3.6-plus",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "qwen3.6-plus",
"CLAUDE_CODE_SUBAGENT_MODEL": "qwen3.6-plus"
}
}Pay-as-you-go
Replace YOUR_API_KEY with the Alibaba Cloud Model Studio API Key. For available models, see Anthropic-compatible API.
Set ANTHROPIC_BASE_URL based on the region. The API key must match the selected region:
China North 2 (Beijing):
https://dashscope.aliyuncs.com/apps/anthropicSingapore:
https://dashscope-intl.aliyuncs.com/apps/anthropic
HELPCODEESCAPE-json
{
"env": {
"ANTHROPIC_AUTH_TOKEN": "YOUR_API_KEY",
"ANTHROPIC_BASE_URL": "https://dashscope-intl.aliyuncs.com/apps/anthropic",
"ANTHROPIC_MODEL": "qwen3.6-plus",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "qwen3.6-flash",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "qwen3.6-plus",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "qwen3.6-plus",
"CLAUDE_CODE_SUBAGENT_MODEL": "qwen3.6-plus"
}
}After saving the configuration, open a new terminal and run claude "hello". A response from the model confirms the setup is working. To verify further, run /status in Claude Code and check that ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN point to the Model Studio address.
Use CC Switch
CC Switch is a community open-source desktop GUI for managing multiple API keys or billing plans. Switch between providers with one click, without editing settings.json manually.
Install CC Switch
macOS:
brew tap farion1231/ccswitch && brew install --cask cc-switch, or download the.dmgfrom Releases.Windows: download the
.msiinstaller or portable.zipfrom Releases.Linux: on Arch, run
paru -S cc-switch-bin; on other distributions, download.deb/.rpm/.AppImagefrom Releases.
Add a provider
- In the CC Switch main interface, select Claude Code in the top icon bar (the orange star icon), then click + in the upper-right corner to open Add New Provider . Fill in the fields based on the table below, then click Add.
| Billing plan | Configuration |
|---|---|
| Token Plan (Team Edition) | Provider name: Bailian-Token Plan API Key: get from console Endpoint: https://token-plan.ap-southeast-1.maas.aliyuncs.com/apps/anthropic |
| Coding Plan | Provider name: Bailian-Coding Plan API Key: get from console Endpoint: https://coding-intl.dashscope.aliyuncs.com/apps/anthropic |
| Pay-as-you-go | Provider name: Bailian-Pay-as-you-go API Key: Model Studio API Key Endpoint: https://dashscope-intl.aliyuncs.com/apps/anthropic |
Expand Advanced Options to configure model mapping. Set the main model and the Haiku, Sonnet, and Opus default models to supported models for your plan. Example mapping:
Main model:
qwen3.6-plusHaiku default model:
qwen3.6-flash(not supported by Coding Plan)Sonnet default model:
qwen3.6-plusOpus default model:
qwen3.6-plus
Return to the main interface, click Enable next to the provider, then start a new Claude Code session for the configuration to take effect.
Connect Claude Code Desktop
Install Claude Code Desktop from the Claude download page.
In the top menu, go to Help > Troubleshooting > Enable Developer Mode . After restarting, a Developer menu appears at the top.
Go to Developer > Configure Third-Party Inference , set Connection to Gateway , fill in the fields based on the table below, then click Apply locally:
| Field | Value |
|---|---|
| Gateway base URL | CC Switch router listen address. Default http://127.0.0.1:15721; if changed, keep it consistent with the next step. |
| Gateway API key | Model Studio API Key |
| Gateway auth scheme | bearer |
| Model list | Model ID must be Anthropic-style, such as claude-opus-4.7. The actual model invoked is determined by CC Switch routing, which corresponds to the model mapping in Advanced Options . Display name only affects the dropdown label. |
In CC Switch, click the settings icon in the upper-left, go to Router , and enable Router Master Switch . The default listen address is
127.0.0.1:15721; if changed, keep it consistent with the previous step.Select the configured model ID from the model dropdown in Claude Code Desktop to start using it.
Claude Code IDE plugins
After completing the CLI configuration above, install the Claude Code plugin in your IDE. The plugin reuses the configuration in settings.json directly.
VS Code
Search for
Claude Code for VS Codein the extension marketplace and install it.Restart VS Code and click the icon in the upper-right corner to open Claude Code.
Type
/in the dialog box, select General config , and set the model in Selected Model.
JetBrains
Search for
Claude Codein the extension marketplace and install it.Restart the IDE and click the icon in the upper-right corner to start using it.
FAQ
Error codes
If you encounter errors during configuration, refer to the FAQ documentation for your billing plan:
Pay-as-you-go: Anthropic API Compatible - Error Codes
Coding Plan: Coding Plan FAQ
Token Plan (Team Edition): Token Plan (Team Edition) FAQ
After starting Claude Code, the interface displays "Unable to connect to Anthropic services. Failed to connect to api.anthropic.com: ERR_BAD_REQUEST"
Claude Code is connecting to the official Anthropic service instead of Alibaba Cloud Model Studio. This usually means the environment variables are missing or have not taken effect. Follow these steps:
Check the configuration. Run the
/statuscommand after starting Claude Code. Verify thatANTHROPIC_BASE_URLandANTHROPIC_AUTH_TOKENpoint to the Model Studio address. If the output is empty or shows a non-Model Studio address, check thesettings.jsonconfiguration.Verify hasCompletedOnboarding. Confirm that
hasCompletedOnboardingis set totruein~/.claude.json. Without this, Claude Code attempts to connect to the official Anthropic service for login verification on startup.Open a new terminal. After editing the configuration file, open a new terminal window and run
claudefor the changes to take effect.