Setting Up Claude Code - Domestic Provider Configuration Guide
Claude Code is a powerful AI-assisted programming tool that can significantly improve development efficiency and code quality. This guide will help you install Claude Code and select a suitable domestic model provider.
Installing Claude Code
Section titled “Installing Claude Code”Why NPM Installation is Recommended
Section titled “Why NPM Installation is Recommended”Claude Code provides two official installation methods:
- Native Installation: Requires downloading binary files from GitHub Releases
- Official Script Installation: Requires running the official installation script
Due to network restrictions, the above methods may not work properly in mainland China. Therefore, we recommend using the NPM installation method, which is more stable and performs better in mainland China network environments.
Installing via NPM
Section titled “Installing via NPM”Installing Claude Code via NPM is very convenient. Make sure you have Node.js installed.
npm install -g @anthropic-ai/claude-codeAfter installation, verify the installation was successful:
claude --versionConfiguring Model Providers
Section titled “Configuring Model Providers”Claude Code supports two configuration methods:
- Recommended: Using
settings.jsonconfiguration file - Legacy: Using environment variables (still works)
Configuration File Location
Section titled “Configuration File Location”The location of Claude Code’s settings.json file varies by operating system:
C:\Users\<Your Username>\.claude\settings.json~/.claude/settings.json~/.claude/settings.jsonChoose a subscription website first
Section titled “Choose a subscription website first”If you have not decided which provider to buy yet, start with AI Service Subscriptions. The new chapter gathers the currently recommended subscription entry points into one top-level section, so you can compare first and then return here to finish Claude Code configuration.
Zhipu AI (ZAI) [Recommended]
Section titled “Zhipu AI (ZAI) [Recommended]”Zhipu AI provides GLM Coding Plan, specifically designed for AI programming tools like Claude Code. It offers good value and supports various advanced features.
Purchasing a Subscription
Section titled “Purchasing a Subscription”To use ZAI, you need to purchase a subscription and get an API Key. For code writing, we recommend purchasing the Coding Plan for daily use, as it is more cost-effective.
Purchase through the following link for exclusive discounts: https://www.bigmodel.cn/claude-code?ic=14BY54APZA
Zhipu GLM Coding: 20+ Programming Tools Seamless Support
Claude Code, Cline, and 20+ other programming tools seamlessly supported, maximizing your coding productivity!
- World-class Programming Models: GLM-5 achieves SOTA performance in reasoning, code, and agent capabilities among open-source models when released
- Larger Capacity, Lower Price: 1/3 the price of Claude Code, 3x the usage, as low as 49 RMB per month
- Free Exclusive MCP: Includes image/video understanding, web search, web page reading, open-source repository MCP
Method One: Using settings.json Configuration File [Recommended]
Section titled “Method One: Using settings.json Configuration File [Recommended]”Add the following configuration to your settings.json file:
{ "env": { "ANTHROPIC_AUTH_TOKEN": "your-api-key", "ANTHROPIC_BASE_URL": "https://open.bigmodel.cn/api/anthropic", "ANTHROPIC_DEFAULT_HAIKU_MODEL": "glm-4.5-air", "ANTHROPIC_DEFAULT_OPUS_MODEL": "glm-5", "ANTHROPIC_DEFAULT_SONNET_MODEL": "glm-4.7" }}Method Two: Using Environment Variables
Section titled “Method Two: Using Environment Variables”# Set API Keyexport ANTHROPIC_AUTH_TOKEN=your-api-key-here
# Set API URLexport ANTHROPIC_API_URL=https://open.bigmodel.cn/api/anthropicMethod Three: Using the coding-helper Tool
Section titled “Method Three: Using the coding-helper Tool”ZAI provides a simple command-line tool coding-helper to help you configure Claude Code.
# Enter the command line interface and run the Coding Tool Helpernpx @z_ai/coding-helperAfter running, you will enter an interactive command-line interface. Follow the prompts to enter your API Key and select Claude Code to complete the configuration.
Model Mapping
Section titled “Model Mapping”Zhipu AI provides multiple model options, with the following mapping to Claude model tiers:
| Claude Tier | ZAI Model |
|---|---|
| Sonnet | glm-4.7 |
| Opus | glm-5 |
| Haiku | glm-4.5-air |
MiniMax
Section titled “MiniMax”MiniMax provides Claude API-compatible service using a unified MiniMax-M2.5 model for all tiers.
Getting an API Key
Section titled “Getting an API Key”Get your API Key through the following link: https://platform.minimaxi.com/subscribe/coding-plan?code=8wNck4etDM&source=link
MiniMax Claude API Compatible Service
MiniMax provides Claude API-compatible service with support for multiple model integrations, stable and reliable.
Method One: Using settings.json Configuration File [Recommended]
Section titled “Method One: Using settings.json Configuration File [Recommended]”Add the following configuration to your settings.json file:
{ "env": { "ANTHROPIC_AUTH_TOKEN": "your-api-key", "ANTHROPIC_BASE_URL": "https://api.minimaxi.com/anthropic", "ANTHROPIC_DEFAULT_HAIKU_MODEL": "MiniMax-M2.5", "ANTHROPIC_DEFAULT_OPUS_MODEL": "MiniMax-M2.5", "ANTHROPIC_DEFAULT_SONNET_MODEL": "MiniMax-M2.5" }}Method Two: Using Environment Variables
Section titled “Method Two: Using Environment Variables”# Set API Keyexport ANTHROPIC_AUTH_TOKEN=your-api-key-here
# Set API URLexport ANTHROPIC_API_URL=https://api.minimaxi.com/anthropicModel Mapping
Section titled “Model Mapping”MiniMax uses a unified model for all tiers:
| Claude Tier | MiniMax Model |
|---|---|
| Sonnet | MiniMax-M2.5 |
| Opus | MiniMax-M2.5 |
| Haiku | MiniMax-M2.5 |
Alibaba Cloud DashScope
Section titled “Alibaba Cloud DashScope”Alibaba Cloud’s DashScope platform provides Claude API-compatible service using a unified glm-4.7 model for all tiers.
Activating the Service
Section titled “Activating the Service”Activate the service through the following link: https://www.aliyun.com/benefit/ai/aistar?userCode=vmx5szbq&clubBiz=subTask..12384055..10263..
Alibaba Cloud Qianwen Coding Plan Launched
Alibaba Cloud Qianwen Coding Plan is now available to meet daily development needs. Recommended + Hagicode, perfect for achieving various needs during development.
After successful activation, you can create an API Key in the Alibaba Cloud console.
Method One: Using settings.json Configuration File [Recommended]
Section titled “Method One: Using settings.json Configuration File [Recommended]”Add the following configuration to your settings.json file:
{ "env": { "ANTHROPIC_AUTH_TOKEN": "your-api-key", "ANTHROPIC_BASE_URL": "https://coding.dashscope.aliyuncs.com/apps/anthropic", "ANTHROPIC_DEFAULT_HAIKU_MODEL": "glm-4.7", "ANTHROPIC_DEFAULT_OPUS_MODEL": "glm-4.7", "ANTHROPIC_DEFAULT_SONNET_MODEL": "glm-4.7" }}Method Two: Using Environment Variables
Section titled “Method Two: Using Environment Variables”# Set API Keyexport ANTHROPIC_AUTH_TOKEN=your-api-key-here
# Set API URLexport ANTHROPIC_API_URL=https://coding.dashscope.aliyuncs.com/apps/anthropicModel Mapping
Section titled “Model Mapping”Alibaba Cloud uses a unified model for all tiers:
| Claude Tier | Alibaba Cloud Model |
|---|---|
| Sonnet | glm-4.7 |
| Opus | glm-4.7 |
| Haiku | glm-4.7 |