All Products
Search
Document Center

Alibaba Cloud Model Studio:Claude Code

Last Updated:Jun 25, 2026

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

  1. Install or update Node.js (v18.0 or later).

  2. Run the following command to install Claude Code.

    npm install -g @anthropic-ai/claude-code
  3. Verify the installation. A version number in the output confirms success.

    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.

npm install -g @anthropic-ai/claude-code
For 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.

{
  "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).

{
    "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.

{
    "env": {
        "ANTHROPIC_AUTH_TOKEN": "YOUR_API_KEY",
        "ANTHROPIC_BASE_URL": "https://coding-intl.dashscope.aliyuncs.com/apps/anthropic",
        "ANTHROPIC_MODEL": "qwen3.7-plus",
        "ANTHROPIC_DEFAULT_HAIKU_MODEL": "qwen3.7-plus",
        "ANTHROPIC_DEFAULT_SONNET_MODEL": "qwen3.7-plus",
        "ANTHROPIC_DEFAULT_OPUS_MODEL": "qwen3.7-plus",
        "CLAUDE_CODE_SUBAGENT_MODEL": "qwen3.7-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/anthropic

  • Singapore: https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/apps/anthropic. Replace WorkspaceId with your actual Get the Workspace ID.

{
    "env": {
        "ANTHROPIC_AUTH_TOKEN": "YOUR_API_KEY",
        "ANTHROPIC_BASE_URL": "https://{WorkspaceId}.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"
    }
}

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 .dmg from Releases.

  • Windows: download the .msi installer or portable .zip from Releases.

  • Linux: on Arch, run paru -S cc-switch-bin; on other distributions, download .deb / .rpm / .AppImage from Releases.

Add a provider

  1. 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://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/apps/anthropic

  2. 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.7-max (not supported by Coding Plan)

    • Haiku default model: qwen3.6-flash (not supported by Coding Plan)

    • Sonnet default model: qwen3.7-max (not supported by Coding Plan)

    • Opus default model: qwen3.7-max (not supported by Coding Plan)

  3. 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

  1. Install Claude Code Desktop from the Claude download page.

  2. In the top menu, go to Help > Troubleshooting > Enable Developer Mode. After restarting, a Developer menu appears at the top.

  3. 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.

  4. 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.

  5. 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

  1. Search for Claude Code for VS Code in the extension marketplace and install it.

  2. Restart VS Code and click the icon in the upper-right corner to open Claude Code.

  3. Type / in the dialog box, select General config, and set the model in Selected Model.

JetBrains

  1. Search for Claude Code in the extension marketplace and install it.

  2. 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:

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:

  1. Check the configuration. Run the /status command after starting Claude Code. Verify that ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN point to the Model Studio address. If the output is empty or shows a non-Model Studio address, check the settings.json configuration.

  2. Verify hasCompletedOnboarding. Confirm that hasCompletedOnboarding is set to true in ~/.claude.json. Without this, Claude Code attempts to connect to the official Anthropic service for login verification on startup.

  3. Open a new terminal. After editing the configuration file, open a new terminal window and run claude for the changes to take effect.