Back to Blog
tutorialsclaude-code

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.

April 8, 20263 min readCyberFisher

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

Ready to use AI APIs?

Try CCSub for free — new users get free API credits

Get Started

Related Posts