Get started
Using Claude Code from mainland China
Claude Code itself installs fine in mainland China; the account, payment and network behind it are the hard part. This page explains why the official service does not work there and how to use genuine Claude through CoreCode, with no overseas account or foreign card and no proxy.
- Anthropic does not offer its services in mainland China: neither mainland China nor Hong Kong is on its list of supported regions.
- A relay holds official Anthropic accounts outside China, and Claude Code sends requests to it through
ANTHROPIC_BASE_URL. - CoreCode takes Alipay and WeChat Pay at ¥1 = $1 of credit, and
corecode.liveis reachable directly from mainland China, with no proxy. - If first launch hangs connecting to Anthropic, add
"hasCompletedOnboarding": trueto~/.claude.json.
Why the official service does not work
Claude Code needs a Claude subscription or an Anthropic API key, and sends requests to api.anthropic.com. From mainland China there are three obstacles:
| Step | Problem |
|---|---|
| Account | Anthropic does not offer its services in mainland China. Sign-up and sign-in require a supported region, and accounts can be suspended for region reasons. |
| Payment | Subscriptions and API credit take foreign credit cards only, not Alipay or WeChat Pay. |
| Network | Direct requests are refused, and Claude Code reports 403 Request not allowed or Unable to connect to Anthropic services. |
How a relay solves it
Claude Code can send its requests to another address through ANTHROPIC_BASE_URL. A relay holds official Anthropic accounts outside China: your Claude Code sends requests to the relay, the relay forwards them unchanged to Anthropic and returns the reply. You need only a relay key, and you pay and connect from within China.
Relays differ a lot in quality: some swap in cheaper models, some never hit the cache and end up costing more than Anthropic. See How to choose a relay and Check a relay is genuine.
Connect with CoreCode
-
Install Claude Code
On macOS, Linux and WSL run
curl -fsSL https://claude.ai/install.sh | bash; in Windows PowerShell runirm https://claude.ai/install.ps1 | iex. If the download is slow or fails, use npm instead:npm install -g @anthropic-ai/claude-code(Node.js 22 or later; a mainland npm mirror helps). Windows details are in Claude Code on Windows. -
Sign up, top up, create a key
Sign in on the sign-in page with Google, LinuxDO or an email code. Top up in Wallet with Alipay or WeChat Pay: ¥1 buys $1 of credit, and the newcomer pack is ¥29.9 for $50. Then create a key on the API keys page in the Claude 满血(仅限CC)group.
-
Put it in the settings file
Edit
~/.claude/settings.json(on Windows,%USERPROFILE%\.claude\settings.json), creating it if needed:{ "env": { "ANTHROPIC_BASE_URL": "https://corecode.live", "ANTHROPIC_AUTH_TOKEN": "sk-your-key", "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1" } }The third line turns off auto-update, telemetry and other requests to Anthropic's own services, which are unreachable from mainland China. Upgrade by hand with
claude updateafterwards.
Open a new terminal, run claude and send a message. Type /status in Claude Code; a Base URL of https://corecode.live means you are connected. The full guide is Claude Code.
On mainland networks
- No proxy needed.
corecode.liveis served through an edge node in Tokyo and is reachable directly from mainland China. A global proxy only adds a detour; add a DIRECT rule forcorecode.livein your proxy client. - First launch hangs connecting to Anthropic. Onboarding contacts the official service. Add
"hasCompletedOnboarding": trueat the top level of~/.claude.jsonto skip it; see Errors. - Do not
/loginwith a claude.ai account. Claude Code would switch to the official account and conflict with the relay key. If you signed in before, run/logout. - Long silences are normal. Extended thinking can go minutes without text; the gateway's read timeout is 10 minutes.
Next
What Claude Code costs depends mostly on the cache hit rate, so read Caching and billing and Spending less on Claude Code. For errors see Errors, or ask in the WeChat group.
FAQ
Can I use the official Claude Code directly from mainland China?
The account, payment and network all stand in the way: Anthropic does not serve mainland China, payment takes foreign cards only, and direct requests are refused. See why the official service does not work.
Do I need a proxy for CoreCode?
No. corecode.live is served through an edge node in Tokyo and is reachable directly; a global proxy only adds a detour, so add a DIRECT rule for it.
How do I pay?
Top up in the console's Wallet with Alipay or WeChat Pay: ¥1 buys $1 of credit, from ¥10; the newcomer pack is ¥29.9 for $50.
Is it still genuine Claude through a relay?
CoreCode's upstream is official Anthropic Claude accounts only, with the native protocol passed through. You need not take our word for it: verify it with the checking script.