Short answer: to use Claude Code from mainland China without a VPN, point ANTHROPIC_BASE_URL at Router One's Anthropic-compatible endpoint (https://api.router.one), set ANTHROPIC_AUTH_TOKEN to a Router One key, and top up by card or Alipay on the hosted checkout — no foreign credit card needed.
Claude Code is arguably the most powerful AI coding assistant available today. It runs directly in your terminal, understands entire codebases, and can execute multi-step development tasks autonomously. But if you are a developer based in China, actually getting it to work is a different story entirely.
This guide is the operational setup path: prerequisites, shell environment variables, a quick status check, payment notes, and the common China-specific errors you are most likely to hit.
The Three Barriers to Using Claude Code in China
1. Network Accessibility
Anthropic's API endpoints are not reliably accessible from mainland China networks. Whether you are on China Telecom, China Unicom, or China Mobile, direct connections to api.anthropic.com suffer from packet loss, timeouts, and outright blocks. VPN solutions add latency, drop connections during long coding sessions, and create a frustrating experience when Claude Code needs sustained, stable connectivity for multi-turn conversations.
2. Payment Methods
Anthropic requires a non-Chinese credit card to purchase API credits. This means you need a Visa or Mastercard issued outside mainland China. For most Chinese developers, this is a significant hurdle. Setting up an overseas bank account or finding a friend to help with payments is not a sustainable workflow. If the console itself refuses your region (unsupported_country_region_territory), see the region-block guide.
3. Rate Limits and Availability
Even if you solve the network and payment problems, Anthropic applies aggressive rate limits on their API, especially during peak hours. Heavy Claude Code sessions that involve large codebases can hit these limits quickly, interrupting your flow right when you need it most.
How Router One Solves All Three
China-Accessible API Endpoint
Router One provides an Anthropic-compatible API endpoint at https://api.router.one that is directly reachable from major Chinese ISPs. No VPN or proxy configuration is required. Network conditions still vary by ISP, city and time of day, so rely on the dated benchmark below rather than on any single measurement.
Based on the China latency benchmark last updated 2026-05-15, Router One measured 110-130ms p50 across Beijing, Shanghai, and Shenzhen; individual networks may vary. See the evidence page at China latency benchmark.
Card and Alipay Support
Router One takes card and Alipay top-ups through one hosted checkout. Open the Router One dashboard, click top-up, enter an amount, and confirm on the checkout page — your balance is available as soon as the payment clears. No foreign credit card needed. The checkout page is the source of truth for the minimum amount. Card and Alipay top-ups currently usually start at $5 USD equivalent; RMB amounts are converted and shown at checkout using the current FX rate. Stablecoin top-ups usually start at $5 USD equivalent.
Paid-Usage Headroom
No low fixed cap for normal paid usage. Each key and each account runs under default request-per-minute and token-per-minute limits, and upstream constraints may still apply; if a request returns 429, back off and retry (honor Retry-After when it is sent), and if your traffic needs higher limits, email support@router.one to have the key or account limits raised.
Quick Setup: 2 Environment Variables
If you have already installed Claude Code, connecting it to Router One takes under a minute. Export two environment variables:
export ANTHROPIC_BASE_URL=https://api.router.one
export ANTHROPIC_AUTH_TOKEN=sk-your-router-one-api-key
unset ANTHROPIC_API_KEY
Replace sk-your-router-one-api-key with your actual API key from the Router One dashboard.
ANTHROPIC_AUTH_TOKEN is the credential Claude Code sends to a third-party gateway. ANTHROPIC_API_KEY is not required — on current builds setting it triggers an extra approval prompt at launch, so unset it if you exported it earlier.
For persistent configuration, add the two export lines to your ~/.zshrc or ~/.bashrc (and remove any leftover ANTHROPIC_API_KEY line).
Claude Code 2.1.284 or later: the sonnet alias sends claude-sonnet-5-5 (per the Claude Code changelog, checked 2026-09-29). Router One lists it from 2026-09-29, but no plan tier covers it, so on a plan also export ANTHROPIC_DEFAULT_SONNET_MODEL=claude-sonnet-5 to keep /model sonnet, the execution phase of opusplan and Sonnet subagents on plan quota. With or without a plan, also export ANTHROPIC_DEFAULT_FABLE_MODEL=claude-fable-5: per Claude Code's model configuration docs (Claude Code 2.1.296, checked 2026-10-10), the fable alias otherwise resolves to Claude Fable 5.1 (claude-fable-5-1), which Router One no longer lists as of the 2026-10-09 catalog; Claude Fable 5 is in no plan tier as of the 2026-10-09 plan response, so it bills to the wallet. Optionally add ANTHROPIC_DEFAULT_HAIKU_MODEL=claude-haiku-4-5 so background tasks run on Claude Haiku 4.5; per Claude Code's changelog and model configuration docs (Claude Code 2.1.296, checked 2026-10-10), from 2.1.293 the haiku alias resolves to claude-haiku-5-5 (Claude Haiku 5.5), which Router One lists as of the 2026-10-10 catalog but no plan tier lists in the 2026-10-10 plan response, so without the line that alias bills per token to the wallet.
For a detailed step-by-step walkthrough, see our Claude Code Setup Guide.
Plan Holders: Pin the Model
Skip this if you pay from the wallet. Claude Code 2.1.280 and later sends claude-opus-5-5 unless a model is pinned, and as of the 2026-09-29 plan response no Pro, Max or Ultra tier lists Claude Opus 5.5, so those calls bill per token to your wallet. To keep drawing plan quota, pin Claude Opus 5, which the plans' Premium models tier covers:
export ANTHROPIC_MODEL=claude-opus-5
export ANTHROPIC_DEFAULT_OPUS_MODEL=claude-opus-5
The second line points the opus alias at Opus 5 as well, so /model opus and subagents defined with model: opus stay on the plan too. If you used the one-click installer, put both keys in the env block of ~/.claude/settings.json instead — a value there overrides the shell export. Claude Code on Opus 5.5 covers the details.
Verify the Setup
Open a new terminal after editing your shell profile, then run:
echo $ANTHROPIC_BASE_URL
claude /status
The base URL should print https://api.router.one. If claude /status still points at Anthropic directly, restart the terminal session and confirm there are no older Claude Code settings in ~/.claude.
Real-World Latency: Direct vs Router One from China
The table below is a snapshot from the published benchmark. Based on the China latency benchmark last updated 2026-05-15, Router One measured 110-130ms p50 across Beijing, Shanghai, and Shenzhen; individual networks may vary.
| City | Direct (via VPN) | Router One | Improvement |
|---|---|---|---|
| Shanghai | 620ms avg, 12% timeout rate | 120ms avg, 0% timeout | 5x faster |
| Beijing | 580ms avg, 8% timeout rate | 110ms avg, 0% timeout | 5x faster |
| Shenzhen | 700ms avg, 15% timeout rate | 130ms avg, 0% timeout | 5x faster |
VPN-based access can produce inconsistent latency with frequent timeouts that force Claude Code to retry. Router One publishes this benchmark so latency claims on the site have a single evidence source.
Card and Alipay Top-Up Walkthrough
Funding your Router One account takes about 30 seconds:
- Log in to your account at router.one
- Navigate to the billing or top-up section in the dashboard
- Enter the amount you want to add. The checkout page is the source of truth for the minimum amount. Card and Alipay top-ups currently usually start at $5 USD equivalent; RMB amounts are converted and shown at checkout using the current FX rate. Stablecoin top-ups usually start at $5 USD equivalent.
- Continue to the hosted checkout page
- Choose card or Alipay there
- Confirm payment — your balance updates once it clears
Router One supports prepaid wallet billing and live subscription plans. You can pay per token from wallet balance, with per-token pricing visible on the Models page, or choose a plan on the pricing page for predictable monthly spend.
Troubleshooting China-Specific Issues
For 401/403 see the Claude Code 403 checklist; the three causes behind a 429 are in LLM API 429 errors, and every other status code is on the error-code reference.
DNS resolution failures — If api.router.one does not resolve, compare the affected device’s resolver result with another network and check local hosts, proxy, and VPN/TUN settings. A DNS failure alone does not identify a carrier or prove filtering. Follow the API connection troubleshooting guide before changing network settings.
Corporate firewall blocking — If you are on a corporate network that blocks outbound HTTPS to unfamiliar domains, ask your IT team to whitelist api.router.one and router.one. Router One uses standard HTTPS on port 443, so there is nothing unusual about the traffic pattern.
Claude Code not picking up environment variables — Make sure you open a new terminal session after adding the exports to your shell profile. Run echo $ANTHROPIC_BASE_URL to verify the variable is set correctly before launching claude.
429 rate limit exceeded — No low fixed cap for normal paid usage. Each key and each account runs under default request-per-minute and token-per-minute limits, and upstream constraints may still apply; if a request returns 429, back off and retry (honor Retry-After when it is sent), and if your traffic needs higher limits, email support@router.one to have the key or account limits raised.
Slow response during peak hours — China's international bandwidth gets congested during business hours (roughly 9 AM - 6 PM CST), which can slow any cross-border path. If you notice slowness, try again in a few minutes; report consistent slowness to our support with the request ID from Dashboard → Logs.
Payment not reflecting — card and Alipay top-ups usually credit within seconds. If your balance has not updated after 5 minutes, check your payment app to confirm the transaction completed, then contact support with the transaction ID.
FAQ
Why does api.router.one fail to resolve on my network?
The hostname, local resolver, hosts file, proxy, or network path may be involved. Compare results on the affected device and a second network; a single failed lookup does not establish the cause. Use the DNS and TLS checklist to separate these cases.
Can I use Claude Code with Router One from a corporate network?
Yes — if the firewall blocks outbound HTTPS to unfamiliar domains, ask your IT team to whitelist api.router.one and router.one. Router One uses standard HTTPS on port 443, so there is nothing unusual about the traffic pattern.
Why is Claude Code not picking up ANTHROPIC_BASE_URL?
Open a new terminal session after adding the exports to your shell profile, then run echo $ANTHROPIC_BASE_URL to verify the variable is set before launching claude. If claude /status still shows the old endpoint, confirm there are no older Claude Code settings in ~/.claude.
What does a 429 rate limit error mean on Router One? No low fixed cap for normal paid usage. Each key and each account runs under default request-per-minute and token-per-minute limits, and upstream constraints may still apply; if a request returns 429, back off and retry (honor Retry-After when it is sent), and if your traffic needs higher limits, email support@router.one to have the key or account limits raised.
Why is Claude Code slower during Chinese business hours? China's international bandwidth gets congested during business hours (roughly 9 AM - 6 PM CST), which can slow any cross-border path. If you notice occasional slowness, try again in a few minutes; report consistent slowness to our support with the request ID from Dashboard → Logs.
How long does a card or Alipay top-up take to reach my balance? Card and Alipay top-ups usually credit within seconds. If your balance has not updated after 5 minutes, confirm in your payment app that the transaction completed, then contact support with the transaction ID.
Get Started
Claude Code is too good a tool to be blocked by network issues and payment friction. Router One removes these barriers so you can focus on what matters — writing code with the best AI assistant available.
- Sign up at router.one
- Top up with a card or Alipay
- Configure your two environment variables
- Start coding with Claude Code
For detailed setup instructions, see our Claude Code Setup Guide. To explore all supported models and pricing, visit the Models page.
Related Canonical Pages
- Commercial page: Claude Code in China
- Setup docs: CLI setup guide
- Evidence: China latency benchmark
- Trust: Security and Data retention