






















暂无文章
30 viewsEnglishClaude 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 usebase_url=https://cn.crazyrouter.com/v1.
/v1/v1/... issues caused by an incorrect Base URL.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.
Putting Claude Code and Chinese models behind Crazyrouter brings several practical benefits:
https://cn.crazyrouter.com to reduce cross-border routing instability.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.
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:
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:
Available models are subject to the Crazyrouter console and the response from GET https://cn.crazyrouter.com/v1/models.
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.
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.
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.
ANTHROPIC_BASE_URL=https://cn.crazyrouter.com./status first to check the current model and status.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.
/v1 usageIf you want to connect Claude Code, Chinese models, or your own applications to Crazyrouter through a unified interface, follow this sequence:
https://cn.crazyrouter.com; use https://cn.crazyrouter.com/v1 for OpenAI-compatible SDKs./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.
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。