惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

The GitHub Blog
The GitHub Blog
阮一峰的网络日志
阮一峰的网络日志
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Apple Machine Learning Research
Apple Machine Learning Research
小众软件
小众软件
博客园 - 司徒正美
Last Week in AI
Last Week in AI
爱范儿
爱范儿
罗磊的独立博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园_首页
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
The Cloudflare Blog
雷峰网
雷峰网
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
WordPress大学
WordPress大学
Jina AI
Jina AI
人人都是产品经理
人人都是产品经理
量子位
V
V2EX
博客园 - 叶小钗
宝玉的分享
宝玉的分享
T
Tailwind CSS Blog

Crazyrouter Blog

Gemini CLI Complete Guide 2026: Repo Automation, CI Agents, and Multi-Model Routing Ideogram AI Guide 2026: Brand Design Automation, API Workflows, and Alternatives GLM 4.6 API Guide 2026: Agents, RAG, Tool Calling, and Bilingual Apps WAN 2.2 Animate Tutorial 2026: Character Consistency, Shot Control, and API Workflows Google Veo3 API Guide 2026: Production Video Pipelines, Prompts, Pricing, and Fallbacks AI API Pricing Comparison 2026: Text, Image, Video, Caching, and Router Costs Codex CLI Installation Guide 2026: Windows, macOS, Linux, Proxies, and CI Setup How to Get a Claude API Key in 2026: Secure Setup for Teams, CI, and Alternatives Gemini Advanced Review 2026: Is It Worth It for Coding, Research, and API Teams? Seedance 2.0 Pricing: Convert 46 CNY per Million Tokens to Cost per Second Seedance 2.0 计费详解:46元/百万Token换算成每秒多少钱 Seedance 2.0料金解説:100万Tokenあたり46元を1秒あたりコストに換算 Gemini CLI 使用教程 2026:安装、代码示例、代理环境与 API 接入 Gemini 是什么?2026 完整介绍、API 使用教程与价格对比 Qwen2.5-Omni Guide 2026: Real-Time Voice, Vision, and Multimodal Agents Kimi K2 Thinking Guide 2026: Reasoning Workflows, Evals, and Cost Control Google Veo3 API Guide 2026: Batch Video Pipelines, Pricing, and Fallbacks Codex CLI Installation Guide 2026: macOS, Linux, WSL, Proxies, and Dev Containers How to Get a Claude API Key in 2026: Safe Production Setup and Alternatives AI API Pricing Comparison 2026: GPT, Claude, Gemini, Video, and Agent Workloads Gemini Advanced Review 2026: Is It Worth It for Developer Teams? Claude Code Pricing Guide 2026: API Fallbacks, Team Seats, and Budget Control Seedream 4.0 API Tutorial 2026: Batch Image Generation, Product Creative, and Pricing Qwen2.5-Omni Guide 2026: Real-Time Voice, Vision, Text Agents, and API Integration Kimi K2 Thinking Guide 2026: Reasoning Agents, Evaluation Workflows, and API Cost Control WAN 2.2 Animate Tutorial 2026: Character Motion, Shot Control, API Pipelines, and Pricing Google Veo3 API Guide 2026: Production Video Workflows, Prompts, Pricing, and Fallbacks AI API Pricing Comparison 2026: OpenAI, Claude, Gemini, DeepSeek, and Router Costs How to Get a Claude API Key in 2026: Setup, Security, Rotation, and Alternatives Codex CLI Installation Guide 2026: macOS, Linux, WSL, Proxies, and Devcontainers
05|Use Crazyrouter to Access Chinese Models in Claude Code
Crazyrouter Team · 2026-06-10 · via Crazyrouter Blog

30 viewsEnglishClaude Code

05|Use Crazyrouter to Access Chinese Models Uniformly in Claude Code#

This is Part 05 of the Crazyrouter Claude Code series. This article focuses on “using Crazyrouter to access Chinese models uniformly in Claude Code,” covering why you should route everything through Crazyrouter, the correct Claude Code configuration, and the correct configuration for OpenAI-compatible applications.

Unified access pattern: Claude Code / Anthropic native clients use ANTHROPIC_BASE_URL=https://cn.crazyrouter.com; OpenAI-compatible SDKs, HTTP requests, and frontend/backend applications use base_url=https://cn.crazyrouter.com/v1.

What This Article Covers#

  • Who this is for: developers who are using Claude Code, preparing to connect Chinese models, or want to unify their team’s model calls through Crazyrouter.
  • What you will learn: how to configure environment variables according to the Crazyrouter documentation, organize your workflow, and avoid /v1/v1/... issues caused by an incorrect Base URL.
  • Recommended preparation: first create a separate API Token in the Crazyrouter console, then follow the Claude Code integration documentation to complete the basic setup.

Claude Code can use Claude series models, and it can also use some Chinese models through the Anthropic Messages-compatible protocol. For readers of this site, the key point is not to register with each vendor platform, enable services, and copy keys one by one. Instead, you should route model access uniformly through Crazyrouter.

Use the following unified entry point:

Claude Code appends /v1/messages by itself, so ANTHROPIC_BASE_URL must be the root domain. Do not set it to https://cn.crazyrouter.com/v1, and do not include the full /v1/messages path.

Why Route Everything Through Crazyrouter#

Putting Claude Code and Chinese models behind Crazyrouter brings several practical benefits:

  • One Token can manage multiple types of models, so you do not need to copy keys across multiple platforms.
  • You can view logs, balance, failure reasons, and model usage in one console.
  • You can create a dedicated Token for Claude Code, set budgets and model allowlists, and avoid mixing it with other tools.
  • For networks in China, prioritize https://cn.crazyrouter.com to reduce cross-border routing instability.
  • When switching models later, you only need to adjust the model name or console configuration, without rewriting the entire integration flow.

Correct Claude Code Configuration#

macOS / Linux:

Windows PowerShell:

After reopening the terminal, run:

If you want to automatically check Git, Node.js, and Claude Code, and write the environment variables, you can use Crazyrouter’s one-click setup repository: Crazyrouter Claude Code one-click setup script.

Correct Configuration for OpenAI-Compatible Applications#

If you are not configuring Claude Code, but are calling OpenAI-compatible APIs from your own application, SDK, or backend service, use the /v1 address:

Example:

Model Selection Suggestions#

Do not understand “accessing Chinese models” as jumping to a specific vendor platform. Articles on this site use Crazyrouter’s model list and Token permissions as the default admission criteria.

Choose models based on the task:

  • Code reading, refactoring, and complex engineering tasks: prioritize Claude series models or Coding models that have been verified as compatible with Claude Code.
  • Chinese documentation, summaries, and content processing: choose general-purpose models with strong Chinese capability and moderate cost.
  • Long-context project analysis: choose models with longer context windows and stable output.
  • Batch tasks: prioritize models with lower cost and more stable throughput, and set a budget for the Token.

Available models are subject to the Crazyrouter console and the response from GET https://cn.crazyrouter.com/v1/models.

Common Mistakes#

1. Incorrect Base URL#

Claude Code:

OpenAI-compatible SDK:

If you see /v1/v1/messages or /v1/v1/models in the logs, it usually means /v1 was added to the Base URL twice.

2. The Token Does Not Have Permission for the Model#

If the response returns model not allowed or 403, check the Token allowlist in the Crazyrouter console. Creating a separate Token for Claude Code usually makes troubleshooting easier.

3. Putting the Example Key into Code#

Articles and examples use YOUR_CRAZYROUTER_API_KEY as a placeholder. Do not commit real Tokens to Git, and do not send them to AI tools as long-term context.

  1. Create a dedicated Claude Code Token in the Crazyrouter console.
  2. Configure ANTHROPIC_BASE_URL=https://cn.crazyrouter.com.
  3. Start Claude Code and use /status first to check the current model and status.
  4. Confirm in the Crazyrouter console that the request appears in the logs.
  5. Then switch models or adjust the Token allowlist based on the task.

This workflow works for Claude series models and also for Chinese models accessed compatibly through Crazyrouter. Readers do not need to be directed to other model platforms. All keys, billing, logs, and troubleshooting are handled inside Crazyrouter.


Getting Started with Crazyrouter#

If you want to connect Claude Code, Chinese models, or your own applications to Crazyrouter through a unified interface, follow this sequence:

  1. Go to the Crazyrouter console, create a dedicated API Token, and manage permissions separately by project or team.
  2. Use the root domain for Claude Code: https://cn.crazyrouter.com; use https://cn.crazyrouter.com/v1 for OpenAI-compatible SDKs.
  3. If you need to check the environment automatically or write configuration quickly, use the Crazyrouter one-click Claude Code configuration script.
  4. When debugging failures, check the console logs first, then verify the API Endpoint documentation. Pay special attention to whether the Base URL has an extra /v1.

When you need to evaluate model costs or choose different models, check the Crazyrouter pricing and models page first, then add the models you commonly use to the Token whitelist.