Bridging Claude Code with China’s AI Ecosystem
Claude Code is Anthropic’s powerful agentic coding tool released in May 2025. By default it only works with Anthropic’s own Claude models…
Bridging Claude Code with China’s AI Ecosystem

Claude Code is Anthropic’s powerful agentic coding tool released in May 2025. By default it only works with Anthropic’s own Claude models. However, a growing number of China’s leading AI providers — including Moonshot (Kimi K2), Alibaba Cloud (Qwen-Coder), DeepSeek, Zhipu AI (GLM), and the universal gateway 302.AI — now offer Claude-compatible API endpoints. This means you can use these models directly inside Claude Code without any middleware or code changes. This guide explains why cross-model support was previously difficult, how China’s Claude-compatible APIs solve the problem, and walks you through exact configuration steps for each provider.
1. The Technical Challenge: API Incompatibility
The primary obstacle to using Claude Code with external models is the fundamental difference between API communication formats. Most global AI providers utilize the OpenAI request format, whereas Claude Code requires Anthropic’s proprietary protocol.
Comparison of API Formats

Previously, attempting to redirect Claude Code to a non-Anthropic provider by changing the base URL resulted in errors or garbled output because the tool and the server could not communicate at the protocol level.
2. The Solution: Native Claude-Compatible Endpoints
Starting in 2025, major Chinese AI firms implemented native Anthropic-compatible interfaces. These endpoints “speak” the Anthropic protocol, allowing Claude Code to point directly at Chinese backends with no translation layer required.
Core Providers and Capabilities

3. Implementation and Configuration

3.1 Prerequisites
To integrate Claude Code with these ecosystems, the following environment requirements must be met:
- Node.js: version 18 or higher.
- Claude Code CLI: Installed via
npm install -g @anthropic-ai/claude-code. - API Credentials: A valid API key from the chosen Chinese provider.
3.2 Configuration Process
Claude Code stores its configurations in a settings.json file located in the .claude directory of the user's home folder.
1. Locate/Create Directory:
- macOS/Linux:
~/.claude/settings.json - Windows:
%USERPROFILE%\.claude\settings.json
2. Define Environment Variables:
The JSON file must include three specific environment variables under the "env" key:
ANTHROPIC_BASE_URL: The provider's compatible endpoint.ANTHROPIC_AUTH_TOKEN: The provider-specific API key.ANTHROPIC_MODEL: The specific model ID (e.g.,qwen-coder-plus).
4. Provider-Specific Details
4.1 Moonshot AI (Kimi K2)
Kimi K2 supports the Claude API format natively. Get your API key from platform.moonshot.cn. Edit ~/.claude/settings.json directly:
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.moonshot.cn/anthropic",
"ANTHROPIC_AUTH_TOKEN": "sk-your-moonshot-api-key",
"ANTHROPIC_MODEL": "kimi-k2-0711-preview"
}
}
Available Kimi models:
- Kimi-k2–0711-preview: Optimized for general coding.
- Moonshot-v1–128k: Designed for long-context tasks (up to 128K tokens).
4.2 Alibaba Cloud (Qwen-Coder)
Qwen-Coder exposes a Claude-compatible endpoint via DashScope. Get your API key from dashscope.aliyuncs.com.
{
"env": {
"ANTHROPIC_BASE_URL": "https://dashscope.aliyuncs.com/compatible-mode/anthropic",
"ANTHROPIC_AUTH_TOKEN": "sk-your-dashscope-api-key",
"ANTHROPIC_MODEL": "qwen-coder-plus"
}
}
Available Qwen-Coder models:
- Qwen-coder-plus: Balanced performance.
- Qwen-coder-turbo: Fast and lightweight.
- Qwen-coder-max: Most capable for complex architectural tasks.
4.3 DeepSeek
DeepSeek provides a Claude-compatible interface for both their chat and coder variants. Get your key at platform.deepseek.com.
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.deepseek.com/anthropic",
"ANTHROPIC_AUTH_TOKEN": "sk-your-deepseek-api-key",
"ANTHROPIC_MODEL": "deepseek-v4-pro"
}
}
Available DeepSeek models:
- DeepSeek-V4-Flash: Optimized for high speed and low-latency tasks. Ideal for file organization, web searching, documentation, and simple refactoring.
- DeepSeek-V4-Pro: Tailored for high-level reasoning and heavy coding. Best suited for agentic coding, complex architecture analysis, cross-file debugging, and legal/technical synthesis.
4.4 Zhipu AI (GLM)
Zhipu AI (智谱AI) offers GLM models through an Anthropic-compatible endpoint. GLM-5.1 and GLM-4.5 are particularly strong at coding tasks, multilingual understanding, and long-context reasoning.
Register and get your API key at open.bigmodel.cn (mainland China) or z.ai (international).
Edit ~/.claude/settings.json directly:
Mainland China endpoint:
{
"env": {
"ANTHROPIC_AUTH_TOKEN": "your_zhipu_api_key",
"ANTHROPIC_BASE_URL": "https://open.bigmodel.cn/api/anthropic",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "glm-5.1"
}
}
International endpoint:
{
"env": {
"ANTHROPIC_AUTH_TOKEN": "your_zhipu_api_key",
"ANTHROPIC_BASE_URL": "https://api.z.ai/api/anthropic",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "glm-5.1"
}
}
Available GLM models:
- Lite ($3/month): Access to core GLM models.
- Pro ($9/month): Includes Vision MCP and web search capabilities.
- Max (Custom): Full feature set.
How the connection works:
┌──────────────┐ Anthropic-compatible API ┌──────────────────┐
│ Claude Code │ ──────────────────────────> │ Zhipu AI Cloud │
│ (CLI Tool) │ <────────────────────────── │ (GLM-5.1, etc.) │
└──────────────┘ Response in Claude format └──────────────────┘
4.5 302.AI (Universal Gateway)
302.AI acts as a universal Claude-compatible gateway that proxies all major models — including all of the above — as well as Gemini, GPT-4, and others. Useful if you want to switch models frequently without changing your API key.

Register and get your key at 302.ai.
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.302.ai",
"ANTHROPIC_AUTH_TOKEN": "sk-your-302ai-api-key",
"ANTHROPIC_MODEL": "glm-5.1"
}
}
To switch models, simply change the ANTHROPIC_MODEL value:
"ANTHROPIC_MODEL": "kimi-k2-0711-preview"
"ANTHROPIC_MODEL": "deepseek-coder"
"ANTHROPIC_MODEL": "qwen-coder-plus"
"ANTHROPIC_MODEL": "glm-5.1"
"ANTHROPIC_MODEL": "gemini-2.5-pro"
5. Operational Management within Claude Code
The settings.json structure is the same regardless of provider:
{
"env": {
"ANTHROPIC_BASE_URL": "<provider-claude-compatible-endpoint>",
"ANTHROPIC_AUTH_TOKEN": "<your-api-key>",
"ANTHROPIC_MODEL": "<model-id>"
}
}
Once configured, the CLI allows for active monitoring and real-time adjustments of the model environment.
5.1 Verification of Connection
Users can confirm the active model and endpoint by launching Claude Code and utilizing the following internal commands:
- /status: Displays the active model and base URL to ensure they match the external provider configuration.
- /config: Reviews the current setup parameters.
- Direct Query: Asking the agent “What model are you?” will confirm the identity of the underlying backend (e.g., GLM-5.1).
5.2 Dynamic Model Switching
The system supports “on-the-fly” model transitions without requiring manual edits to the settings.json file.
- Command Line: Use
/model <model-id>(e.g.,/model deepseek-coder) to switch mid-session. - Interactive Picker: Use the
/modelcommand without an ID to open a visual picker controlled by arrow keys.
Conclusion: The Shift to Universal Frontend Architecture
The emergence of native Anthropic-compatible APIs from Chinese providers has fundamentally altered the utility of the Claude Code CLI. It has transitioned from a single-vendor tool tied to Anthropic’s infrastructure into a universal frontend for agentic coding. This flexibility empowers developers to select underlying models based on objective criteria such as:
- Regional Latency: Optimizing response times based on geographical location.
- Language-Specific Strengths: Leveraging models with superior multilingual or regional language understanding.
- Cost Management: Selecting tiers (such as Zhipu’s Lite or Pro) that align with budget constraints.
- Context Requirements: Utilizing specific models like Moonshot’s 128k variant for large-scale codebase analysis.
메타데이터
- post_id
- fb3c2106f686
- slug
- bridging-claude-code-with-chinas-ai-ecosystem-fb3c2106f686
- url
- https://medium.com/@lmpo/bridging-claude-code-with-chinas-ai-ecosystem-fb3c2106f686
- canonical_url
- https://medium.com/@lmpo/bridging-claude-code-with-chinas-ai-ecosystem-fb3c2106f686
- author_url
- https://medium.com/@lmpo
- status
- ok
- fetched_at
- 2026-06-11 10:13:20