Using Claude Code from China: 5-Minute Setup with CCSub Relay
Step-by-step guide to using Claude Code in China without VPN. Sign up for CCSub, create an API key, and configure environment variables. Works on macOS, Windows, Linux, and the VS Code extension.
Using Claude Code from China: 5-Minute Setup with CCSub Relay
Claude Code is Anthropic's official AI coding CLI. The capability is excellent, but direct connections from China are unreliable. Routing through CCSub gives you full Claude Code functionality on Chinese networks with no VPN required.
Why a relay?
Claude Code defaults to api.anthropic.com. From inside China:
- Connections drop or time out frequently
- The official subscription requires a non-Chinese credit card
- Even when you can pay, the FX rate is unfavorable
Routing through CCSub, you get:
- Direct in-China connectivity — no extra latency, no VPN
- ¥1 = $1 USD of API balance — roughly 14% of the official rate
- Full-strength models — Opus 4.6 / Sonnet 4.6 / Haiku 4.5, no quality reductions
Step 1: Sign up for CCSub
Open the CCSub registration page and create an account with your email.
Step 2: Top up your balance
Open "Billing / Subscription" and pay with WeChat Pay, Alipay, or USDT. The minimum top-up is ¥20, and the balance never expires.
Step 3: Create an API key
Open "API Keys", click "Create Key", and pick a group:
- Starter (0.7x) — best price/quality, recommended for daily development
- Pro (0.8x) — Kiro reverse pool, includes 1M context
- Business (2.5x) — Claude Max enterprise pool, dedicated upstream
Copy the sk- prefixed key.
Step 4: Configure Claude Code
macOS / Linux
Open a terminal and run:
export ANTHROPIC_BASE_URL="https://www.ccsub.net/api"
export ANTHROPIC_AUTH_TOKEN="sk-your-key"
To persist, append both lines to ~/.zshrc or ~/.bashrc.
Windows
In CMD:
set ANTHROPIC_BASE_URL=https://www.ccsub.net/api
set ANTHROPIC_AUTH_TOKEN=sk-your-key
VS Code extension
Edit ~/.claude/settings.json:
{
"env": {
"ANTHROPIC_BASE_URL": "https://www.ccsub.net/api",
"ANTHROPIC_AUTH_TOKEN": "sk-your-key"
}
}
One-click via CC-Switch
Install CC-Switch. Then on the CCSub API Keys page, click "Import to CCS" and the relay is configured automatically.
Step 5: Run claude
After configuring, just run claude in your terminal:
claude "write me a React login component"
FAQ
Q: I see "Not logged in"
Add "hasCompletedOnboarding": true to ~/.claude.json, or use CC-Switch to write the config for you.
Q: A single conversation burns through a lot of credit
Long context inflates cost. Use /clear between unrelated tasks to reset the context window.
Q: Which models are supported?
The full Claude family: Opus 4.6, Sonnet 4.6, Haiku 4.5. Sonnet 4.6 is the default.
Sign up to get started → CCSub
Related Posts
Best AI Coding Tools of 2026: Claude Code vs Codex vs OpenClaw vs Cursor
Side-by-side comparison of the leading 2026 AI coding tools — Claude Code, OpenAI Codex, OpenClaw, OpenCode, and Cursor. Compare features, models, pricing, and accessibility from China.
2026 AI API Pricing Showdown: Claude vs GPT vs Gemini (with Real Cost Numbers)
Side-by-side comparison of Anthropic, OpenAI, Google, and AWS Bedrock API pricing as of May 2026. Includes SWE-bench / GPQA benchmarks, measured per-conversation cost, and the final RMB cost via the CCSub relay.