Claude Code works with Qwen models through Alibaba Cloud Model Studio's Anthropic API-compatible interface.
This document applies only to the international mode (Singapore region). Only use Model Studio API keys created in the Singapore region.
Getting started
If you are already familiar with Claude Code, these commands get you started quickly:
This document applies only to pay-as-you-go mode. Coding Plan users must use your exclusive base URL and API key instead. For details, see Coding Plan for Claude Code.
export ANTHROPIC_BASE_URL=https://dashscope-intl.aliyuncs.com/apps/anthropic
export ANTHROPIC_API_KEY=YOUR_DASHSCOPE_API_KEY
export ANTHROPIC_MODEL=qwen3.5-plus # Replace with other models listed in this document
claudeFor detailed configuration instructions, see Detailed steps.
Model availability
Supported models
Model Studio's Anthropic API-compatible service supports:
Series | Supported model name (model) |
Qwen-Max (Some models support thinking mode) | qwen3-max, qwen3-max-2026-01-23 (supports thinking mode), qwen3-max-preview (supports thinking mode) See more |
Qwen-Plus | qwen3.5-plus, qwen3.5-plus-2026-02-15, qwen-plus, qwen-plus-latest, qwen-plus-2025-09-11 See more |
Qwen-Flash | qwen3.5-flash, qwen3.5-flash-2026-02-23, qwen-flash, qwen-flash-2025-07-28 See more |
Qwen-Turbo | qwen-turbo, qwen-turbo-latest See more |
Qwen-Coder (Does not support thinking mode) | qwen3-coder-next, qwen3-coder-plus, qwen3-coder-plus-2025-09-23, qwen3-coder-flash See more |
Qwen-VL (Does not support thinking mode) | qwen3-vl-plus, qwen3-vl-flash, qwen-vl-max, qwen-vl-plus See more |
Open-source Qwen | qwen3.5-397b-a17b, qwen3.5-120b-a10b, qwen3.5-27b, qwen3.5-35b-a3b |
For model parameters and billing rules, see the Model list.
Recommendations
Recommended models by task type:
Complex inference tasks (such as designing application architectures, implementing complex algorithms): Qwen-Plus series (upgraded to Qwen3.5), Qwen-Max series,
qwen3-coder-next(combines coding capabilities with response speed), andqwen3-coder-plus.Simple coding tasks (such as writing functions, generating code comments): Qwen-Flash series and
qwen3-coder-next.
Detailed steps
1. Activate Model Studio
Create an account: If you do not have an Alibaba Cloud account, first create one.
If you encounter issues, see Create an Alibaba Cloud account.
Activate Model Studio: Use your Alibaba Cloud account to go to the Model Studio console. After you read and agree to the terms, Model Studio automatically activates. If the Terms of Service do not appear, the service is already activated.
If a message "You have not completed identity verification" appears, first complete identity verification.
First-time users can get a free quota (valid for 90 days). For details, see the Free quota for new users page.
Exceeding the quota or validity period will incur fees. Use the Free quota only feature to prevent fees in this situation. Actual costs are based on the console's real-time quotes and final bills.
2. Install Claude Code
macOS
Install Node.js v18.0 or later.
Install Claude Code from the terminal:
npm install -g @anthropic-ai/claude-codeVerify the installation:
claude --version
Windows
Claude Code on Windows requires WSL or Git for Windows. Install it from WSL or Git Bash:
npm install -g @anthropic-ai/claude-codeFor details, see the Windows installation tutorial in the Claude Code documentation.
3. Configure base URL, API key, and model
Configure these environment variables to connect Claude Code to Model Studio:
Set
ANTHROPIC_BASE_URLtohttps://dashscope-intl.aliyuncs.com/apps/anthropic.Set
ANTHROPIC_API_KEYorANTHROPIC_AUTH_TOKENto your Model Studio API key.ANTHROPIC_API_KEYorANTHROPIC_AUTH_TOKENcan be used for access authentication. Set only one. The examples below useANTHROPIC_API_KEYas an example.Set
ANTHROPIC_MODELto a supported model from the Model list.
This document applies only to pay-as-you-go mode. Coding Plan users must use your exclusive base URL and API key instead. For details, see Coding Plan for Claude Code.
macOS
Check your default shell type:
echo $SHELLSet the environment variables for your shell:
Zsh
# Replace YOUR_DASHSCOPE_API_KEY with your Model Studio API key echo 'export ANTHROPIC_BASE_URL="https://dashscope-intl.aliyuncs.com/apps/anthropic"' >> ~/.zshrc echo 'export ANTHROPIC_API_KEY="YOUR_DASHSCOPE_API_KEY"' >> ~/.zshrc echo 'export ANTHROPIC_MODEL="qwen3.5-plus"' >> ~/.zshrcBash
# Replace YOUR_DASHSCOPE_API_KEY with your Model Studio API key echo 'export ANTHROPIC_BASE_URL="https://dashscope-intl.aliyuncs.com/apps/anthropic"' >> ~/.bash_profile echo 'export ANTHROPIC_API_KEY="YOUR_DASHSCOPE_API_KEY"' >> ~/.bash_profile echo 'export ANTHROPIC_MODEL="qwen3.5-plus"' >> ~/.bash_profileApply the changes:
Zsh
source ~/.zshrcBash
source ~/.bash_profileVerify the environment variables:
echo $ANTHROPIC_BASE_URL echo $ANTHROPIC_API_KEY echo $ANTHROPIC_MODEL
Windows
Set the Model Studio Base URL and API key as environment variables using CMD or PowerShell.
CMD
Set the environment variables in CMD:
REM Replace YOUR_DASHSCOPE_API_KEY with your Model Studio API key setx ANTHROPIC_API_KEY "YOUR_DASHSCOPE_API_KEY" setx ANTHROPIC_BASE_URL "https://dashscope-intl.aliyuncs.com/apps/anthropic" setx ANTHROPIC_MODEL "qwen3.5-plus"Open a new CMD window and verify:
echo %ANTHROPIC_API_KEY% echo %ANTHROPIC_BASE_URL% echo %ANTHROPIC_MODEL%
PowerShell
Set the environment variables in PowerShell:
# Replace YOUR_DASHSCOPE_API_KEY with your Model Studio API key [Environment]::SetEnvironmentVariable("ANTHROPIC_API_KEY", "YOUR_DASHSCOPE_API_KEY", [EnvironmentVariableTarget]::User) [Environment]::SetEnvironmentVariable("ANTHROPIC_BASE_URL", "https://dashscope-intl.aliyuncs.com/apps/anthropic", [EnvironmentVariableTarget]::User) [Environment]::SetEnvironmentVariable("ANTHROPIC_MODEL", "qwen3.5-plus", [EnvironmentVariableTarget]::User)Open a new PowerShell window and verify:
echo $env:ANTHROPIC_API_KEY echo $env:ANTHROPIC_BASE_URL echo $env:ANTHROPIC_MODEL
4. Run Claude Code
Navigate to your project directory and run claude:
claudeOn first launch, Claude Code may prompt you to log in to an Anthropic account. Skip this step as follows:

Open the
.claude.jsonfile in your home directory:macOS / Linux:
~/.claude.jsonWindows:
C:\Users\%USERNAME%\.claude.json
Set the value of the
hasCompletedOnboardingfield totrue.{ "hasCompletedOnboarding": true }Save the file, then rerun
claudein a new terminal.
(Optional) Additional model configuration methods
Claude Code supports several ways to configure models, listed from highest to lowest priority:
During a conversation: Use
/model <model_name>to switch models. This is useful for temporary changes./model qwen3.5-plusWhen starting Claude Code: Use
claude --model <model_name>to specify a model for a single session.claude --model qwen3.5-plusSet environment variables: Assign different models to tasks of varying complexity. Claude Code automatically selects the appropriate model. This applies globally.
export ANTHROPIC_DEFAULT_OPUS_MODEL="qwen3.5-plus" export ANTHROPIC_DEFAULT_SONNET_MODEL="qwen3.5-plus" export ANTHROPIC_DEFAULT_HAIKU_MODEL="qwen3-coder-next"where:
ANTHROPIC_DEFAULT_OPUS_MODEL: For difficult tasks, such as complex inference and architecture design.ANTHROPIC_DEFAULT_SONNET_MODEL: For daily tasks, such as writing code and implementing features.ANTHROPIC_DEFAULT_HAIKU_MODEL: For simple tasks, such as syntax checks and file searches.
Set permanently in settings.json: Create a
settings.jsonfile in the project root or user home directory with the model configuration. This creates a permanent setting.{ "env": { "ANTHROPIC_DEFAULT_OPUS_MODEL": "qwen3.5-plus", "ANTHROPIC_DEFAULT_SONNET_MODEL": "qwen3.5-plus", "ANTHROPIC_DEFAULT_HAIKU_MODEL": "qwen3-coder-next" } }
Error codes
|
HTTP status code |
Error type |
Description |
|
400 |
invalid_request_error |
The request format or content is invalid. Common causes include missing required request parameters or incorrect data types for parameter values. |
|
400 |
Arrearage |
Your account has an overdue payment. Service is paused. Recharge your account and try again. |
|
403 |
authentication_error |
The API key is invalid. Common causes include missing the API key in the request header or providing an incorrect API key. |
|
404 |
not_found_error |
The requested resource was not found. Common causes include a typo in the compatible endpoint or a model name that does not exist in the request header. |
|
429 |
rate_limit_error |
Your account has reached its rate limit. Reduce your request frequency. |
|
500 |
api_error |
A general internal server error occurred. Try again later. |
|
529 |
overloaded_error |
The API server is overloaded and cannot process new requests at this time. |
FAQ
Question 1: After starting Claude Code, the interface shows “Unable to connect to Anthropic services.” What should I do?

Reconfigure the environment variables, then run claude again.
Question 2: Tokens are consumed too quickly. How to save tokens?
Claude Code scans your project directory, reads code files, and maintains conversation history, consuming significantly more tokens than standard chat. These methods help reduce token usage:
Remove unrelated files: Start Claude Code from your specific project directory with only essential files. Scanning irrelevant files wastes tokens.
Summarize the conversation: Claude Code includes past messages as context. At 95% of the context window, it automatically summarizes the history. To summarize manually, type
/compact.Use precise instructions: Vague requests trigger unnecessary file scans. Ask clear, specific questions to minimize token waste.
Break tasks into smaller steps: For complex tasks, split them into several simple jobs.
Reset the context: Before starting a new task, type
/clearto reset the context and avoid wasting tokens on irrelevant history.
For more token-saving tips, see the official Claude Code documentation. For token usage and expense details, see Bill query and cost management.