All Products
Search
Document Center

Alibaba Cloud Model Studio:Claude Code

Last Updated:Feb 16, 2026

The Qwen series models in Alibaba Cloud Model Studio support Anthropic API-compatible interfaces and can be invoked using Claude Code.

Important
  1. This document applies only to the international edition (Singapore region). Only use API keys created in the Singapore region.

  2. This document applies only to the pay-as-you-go mode. Coding Plan users must use dedicated base URLs and API keys. For details on configuration, see the Coding Plan documentation.

Getting started

If you are already familiar with Claude Code, you can quickly integrate it with Alibaba Cloud Model Studio:

export ANTHROPIC_BASE_URL=https://dashscope-intl.aliyuncs.com/apps/anthropic
export ANTHROPIC_API_KEY=YOUR_DASHSCOPE_API_KEY   # Replace YOUR_DASHSCOPE_API_KEY with your Model Studio API key
export ANTHROPIC_MODEL=qwen3.5-plus # Replace with another supported model as needed.
claude

For detailed instructions, see Detailed steps.

Model configuration

Supported models

The Model Studio Anthropic API-compatible service supports the following Qwen models:

Model Series

Supported model names (model)

Qwen-Max

(Some models support thinking mode)

qwen3-max, qwen3-max-2026-01-23 (supports thinking mode), qwen3-max-preview (supports thinking mode) View more

Qwen-Plus

qwen3.5-plus, qwen3.5-plus-2026-02-15, qwen-plus, qwen-plus-latest, qwen-plus-2025-09-11 View more

Qwen-Flash

qwen-flash, qwen-flash-2025-07-28 View more

Qwen-Turbo

qwen-turbo, qwen-turbo-latest View more

Qwen-Coder

(Does not support thinking mode)

qwen3-coder-plus, qwen3-coder-plus-2025-09-23, qwen3-coder-flash View more

Qwen-VL

(Does not support thinking mode)

qwen-vl-max, qwen-vl-plus

For model specifications and billing rules, see the Model list.

Model recommendations

Use the following models for different task types:

  • Complex reasoning tasks, such as designing application architecture or implementing complex algorithms: Use Qwen-Plus series models (upgraded to Qwen3.5), Qwen-Max series models, or qwen3-coder-plus.

  • Simple coding tasks, such as writing functions or generating code comments: Use Qwen-Flash series models or qwen3-coder-flash.

Detailed steps

1. Activate Alibaba Cloud Model Studio

  1. Create an account: If you do not have an Alibaba Cloud account, create one.

    If you encounter problems, see Create an Alibaba Cloud account.
  2. Activate Alibaba Cloud Model Studio: Use your Alibaba Cloud account to go to Alibaba Cloud Model Studio. After you read and agree to the Terms of Service, Model Studio automatically activates. If the Terms of Service do not appear, the service has already been activated.

    If a message indicates that you have not completed identity verification, complete identity verification first.
After you activate Model Studio for the first time, you receive a free quota for model inference valid for 90 days. For more information, see the Free quota for new users page.
Note

Charges apply if the quota is used up or expires. To avoid these charges, use the Free quota only feature. Actual fees depend on the prices shown in the console and your final bill.

2. Install Claude Code

macOS

  1. Install or update Node.js to version 18.0 or later.

  2. In the terminal, install Claude Code:

    npm install -g @anthropic-ai/claude-code
  3. Verify the installation. If a version number appears, the installation was successful.

    claude --version

Windows

To use Claude Code on Windows, install WSL or Git for Windows. Then, in WSL or Git Bash, run the following command.

npm install -g @anthropic-ai/claude-code
For more information, see the official Claude Code Windows installation tutorial.

3. Configure the base URL, API key, and model

To access the model service in Model Studio using an Anthropic API-compatible method, configure the following environment variables.

  1. ANTHROPIC_BASE_URL: Set this to https://dashscope-intl.aliyuncs.com/apps/anthropic.

  2. ANTHROPIC_API_KEY or ANTHROPIC_AUTH_TOKEN: Set this to your Alibaba Cloud Model Studio API key.

    ANTHROPIC_API_KEY or ANTHROPIC_AUTH_TOKEN for authentication. This topic uses ANTHROPIC_API_KEY as an example.
  3. ANTHROPIC_MODEL: Set this to a supported model from the Model list.

macOS

  1. In the terminal, check the default shell type:

    echo $SHELL
  2. Set the environment variables based on the shell type:

    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"' >> ~/.zshrc

    Bash

    # 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_profile
  3. In the terminal, apply the environment variables:

    Zsh

    source ~/.zshrc

    Bash

    source ~/.bash_profile
  4. In the terminal, check whether the environment variables have taken effect:

    echo $ANTHROPIC_BASE_URL
    echo $ANTHROPIC_API_KEY
    echo $ANTHROPIC_MODEL

Windows

  1. On Windows, use CMD or PowerShell to set the base URL and API key provided by Model Studio as environment variables.

    CMD

    1. In CMD, run the following commands to set the environment variables.

      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"
    2. Open a new CMD window and run the following commands to check whether the environment variables have taken effect.

      echo %ANTHROPIC_API_KEY%
      echo %ANTHROPIC_BASE_URL%
      echo %ANTHROPIC_MODEL%

    PowerShell

    1. In PowerShell, run the following commands to set the environment variables.

      # 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)
    2. Open a new PowerShell window and run the following commands to check whether the environment variables have taken effect.

      echo $env:ANTHROPIC_API_KEY
      echo $env:ANTHROPIC_BASE_URL
      echo $env:ANTHROPIC_MODEL 

4. Run claude code

Go to the project directory and run the claude command in the terminal.

claude

The first time you use claude code, you might need to log on to an Anthropic account. To skip this step:

image

  1. Locate the .claude.json file in your user home directory:

    • macOS / Linux: ~/.claude.json

    • Windows: C:\Users\%USERNAME%\.claude.json

  2. Set the value of the hasCompletedOnboarding field to true.

    {
      "hasCompletedOnboarding": true
    }
  3. Save the file, and then run claude again in a new terminal.

(Optional) More ways to configure models

Claude Code supports the following model configuration methods, listed in descending order of priority. A higher-priority configuration overwrites a lower-priority one.

  1. During a conversation: Run the /model <model_name> command to switch models. This method is suitable for temporarily switching models.

    /model qwen3.5-plus
  2. When starting Claude Code: Run claude --model <model_name> to specify a model. This method is suitable for a single session.

    claude --model qwen3.5-plus
  3. Set environment variables: Set environment variables to select different models based on task complexity. Claude Code automatically selects the appropriate model based on the task type. This method is suitable for global configuration.

    export ANTHROPIC_DEFAULT_OPUS_MODEL="qwen3.5-plus"
    export ANTHROPIC_DEFAULT_SONNET_MODEL="qwen3.5-plus"
    export ANTHROPIC_DEFAULT_HAIKU_MODEL="qwen3-coder-flash"

    Where:

    • ANTHROPIC_DEFAULT_OPUS_MODEL: Used for high-difficulty tasks such as complex reasoning and architecture design.

    • ANTHROPIC_DEFAULT_SONNET_MODEL: Used for common tasks such as code writing and feature implementation.

    • ANTHROPIC_DEFAULT_HAIKU_MODEL: Used for simple jobs such as syntax checking and file searching.

  4. Set in the settings.json configuration file: Create a settings.json file in the project root directory or user home directory and add the model configuration. This method provides a permanent configuration at the project or user level.

    {
      "env": {
        "ANTHROPIC_DEFAULT_OPUS_MODEL": "qwen3.5-plus",
        "ANTHROPIC_DEFAULT_SONNET_MODEL": "qwen3.5-plus",
        "ANTHROPIC_DEFAULT_HAIKU_MODEL": "qwen3-coder-flash"
      }
    }

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 displays "Unable to connect to Anthropic services. Failed to connect to api.anthropic.com: ERR_BAD_REQUEST". What should I do?

image

You can configure the environment variables again and then run the claude command in the terminal.

Question 2: My tokens are consumed too quickly. How do I save tokens?

Claude Code scans the entire project directory, reads relevant code files, and maintains the full conversation history to provide coding suggestions. As a result, token consumption is significantly higher than in typical chat scenarios. Use the following methods to control consumption:

  1. Reduce irrelevant files: To avoid consuming tokens on scanning irrelevant files, start Claude Code in a specific project directory and keep only the necessary project files.

  2. Summarize conversations: Claude Code uses the conversation history as context. When the conversation length reaches 95% of the context window, Claude Code automatically summarizes the content. You can also run the /compact command to summarize the content manually.

  3. Use precise instructions: Vague requests can trigger unnecessary file scans and consume more tokens. Ask clear and specific questions or provide precise instructions when using Claude Code.

  4. Break down tasks: When handling complex tasks, break them down into several simple jobs.

  5. Reset context: Before starting a new task, use the /clear command to reset the context and prevent irrelevant information from consuming tokens.

For more tips on saving tokens, see the official Claude Code documentation. To view your exact token consumption and expense details, see Bill inquiry and cost management.