> Markdown mirror of https://router.one/blog/claude-code-china-guide for AI assistants and crawlers. Router One is an OpenAI-compatible LLM API gateway.
> Published: 2026-04-11 · Last updated: 2026-08-26 · Author: Router One Team

# Claude Code China Setup: Env Vars, /status, and 429 Fixes

_Claude Code in China through Router One: prerequisites, shell setup, /status verification, payment notes, benchmark evidence, and common 429/DNS fixes._

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.

### 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. The endpoint is optimized for Chinese network conditions with routing that avoids congested international links.

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](https://router.one/benchmarks/china-latency).

### Card and Alipay Support

Router One takes card and Alipay top-ups through one hosted checkout. Open the [Router One dashboard](https://router.one/), 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. Abuse prevention, per-account protection limits, and upstream constraints may still apply; if a request returns 429, check Dashboard -> Logs or contact support to raise limits.

## 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:

```bash
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](https://router.one/).

`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).

For a detailed step-by-step walkthrough with screenshots, see our [Claude Code Setup Guide](https://router.one/blog/claude-code-setup-guide).

## Verify the Setup

Open a new terminal after editing your shell profile, then run:

```bash
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:

1. **Log in** to your account at [router.one](https://router.one/)
2. **Navigate** to the billing or top-up section in the dashboard
3. **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.
4. **Continue** to the hosted checkout page
5. **Choose** card or Alipay there
6. **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](https://router.one/models) page, or choose a plan on the [pricing page](https://router.one/pricing) for predictable monthly spend.

## Troubleshooting China-Specific Issues

**DNS resolution failures** — Some Chinese ISPs have aggressive DNS caching or filtering. If `api.router.one` does not resolve, try switching to a public DNS like `223.5.5.5` (Alibaba DNS) or `119.29.29.29` (Tencent DNS).

**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. Abuse prevention, per-account protection limits, and upstream constraints may still apply; if a request returns 429, check Dashboard -> Logs or contact support to raise limits.

**Slow response during peak hours** — China's international bandwidth gets congested during business hours (roughly 9 AM - 6 PM CST). Router One's optimized routing mitigates this, but if you notice any slowness, try again in a few minutes. Consistent slowness should be reported to our support.

**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?**
Some Chinese ISPs have aggressive DNS caching or filtering. Switch to a public DNS such as `223.5.5.5` (Alibaba DNS) or `119.29.29.29` (Tencent DNS) and try again.

**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. Abuse prevention, per-account protection limits, and upstream constraints may still apply; if a request returns 429, check Dashboard -> Logs or contact support to raise limits.

**Why is Claude Code slower during Chinese business hours?**
China's international bandwidth gets congested during business hours (roughly 9 AM - 6 PM CST), and Router One's optimized routing mitigates this. If you notice occasional slowness, try again in a few minutes; consistent slowness should be reported to our support.

**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.

1. **Sign up** at [router.one](https://router.one/)
2. **Top up** with a card or Alipay
3. **Configure** your two environment variables
4. **Start coding** with Claude Code

For detailed setup instructions, see our [Claude Code Setup Guide](https://router.one/blog/claude-code-setup-guide). To explore all supported models and pricing, visit the [Models](https://router.one/models) page.

## Related Canonical Pages

- Commercial page: [Claude Code in China](https://router.one/claude-code-china)
- Setup docs: [CLI setup guide](https://router.one/docs/guides/cli-setup)
- Evidence: [China latency benchmark](https://router.one/benchmarks/china-latency)
- Trust: [Security](https://router.one/security) and [Data retention](https://router.one/data-retention)

## See also

- Canonical page: https://router.one/blog/claude-code-china-guide
- Claude Code China: https://router.one/claude-code-china
- All blog posts: https://router.one/blog
- Models and per-model token rates: https://router.one/models (markdown: https://router.one/models.md)
- Pricing: https://router.one/pricing
- API docs (markdown): https://router.one/docs.md
- Company facts: https://router.one/facts/company.md
