Blog

Claude Proxy Setup for China Users 2026: Complete Configuration Guide | TeamoRouter

Quick Answer

Users in mainland China need a proxy or gateway solution to reliably access Claude's API and web interface in 2026. The three main approaches are: VPN (routes all traffic through an overseas server), relay station (a third-party API proxy), and direct gateway like TeamoRouter (a unified LLM gateway with native China accessibility, no VPN required, and full prompt caching support). The direct gateway approach is the recommended solution for most users because it avoids the latency and cache-breakage issues of VPNs and relay stations. This guide covers all three approaches with step-by-step configuration instructions.

Why Claude Needs a Proxy in China

Claude's official services are hosted on infrastructure that is not always reliably reachable from mainland China:

  • API endpoint: api.anthropic.com may experience high latency, packet loss, or complete inaccessibility depending on your ISP and time of day.
  • Web interface: claude.ai can be slow to load or intermittently blocked.
  • Console: console.anthropic.com (where you manage API keys and billing) has the same accessibility issues.

This is not unique to Claude. Most overseas AI services face similar challenges. The good news is that there are well-established solutions, and in 2026, the options are better than ever.

Approach 1: VPN (Traditional)

A VPN routes all your device's internet traffic through a server in another country. This is the most general-purpose solution and works for every overseas service, not just Claude.

How to Set Up

  1. Choose a VPN provider with servers in regions where Anthropic operates (US, Europe, Japan, Singapore). Popular options as of 2026 include providers with dedicated AI-service-optimized routes.
  2. Install the VPN client on your device.
  3. Connect to a server in a supported region.
  4. Access claude.ai in your browser, or use the API endpoint normally.

Pros and Cons

Pros Cons
Works for all overseas services Adds 50-200ms latency to every request
One-time setup May conflict with corporate VPNs
No per-service configuration Monthly subscription cost
Works for Web and API both Can be throttled or blocked during high-traffic periods
Encrypts all traffic Some VPN IPs are blocked by Anthropic

VPN Configuration for Claude Code

If you use Claude Code with a VPN, no special configuration is needed. Claude Code sends requests through the VPN tunnel like any other application. However, the added latency can make agentic workflows feel sluggish, since each turn involves multiple round trips.

Approach 2: Relay Station (中转站)

A relay station is a third-party service that acts as a proxy specifically for AI API requests. You point your API client at the relay station's URL, and it forwards requests to Anthropic on your behalf.

How It Works

text
Your App --> Relay Station (中转站) --> Anthropic API

The relay station handles the cross-border connection, so your app only needs to reach the relay station's endpoint, which is typically hosted in a China-accessible location.

Setting Up a Relay Station

bash
# Configure your API client to use the relay station
export ANTHROPIC_BASE_URL="https://your-relay-station.com/anthropic"
export ANTHROPIC_API_KEY="your-relay-station-key"

The Hidden Risk: Broken Prompt Caching

Relay stations have a significant downside that is not obvious at first glance. Many relay stations rotate through pools of upstream API accounts to distribute load and work around rate limits. This account rotation means that each request may hit a different upstream account, and since prompt caching in the Anthropic API is tied to a specific account, the cache is effectively broken.

For regular chatbot usage, this is not a big problem. But for agentic workflows like Claude Code, where the agent resends long contexts (often 50K-100K tokens) on every turn, a broken cache means you pay full price for every token on every request. Your actual cost can be 5-10x higher than the listed relay price, making even a "90% off" relay station more expensive than an optimized direct gateway.

How to Check If Your Relay Station Has Cache Problems

Look at your API usage dashboard. If you see high numbers of "cache creation" events and very few "cache read" events, your prompt caching is not working. With a healthy setup, cache reads should account for the majority of your input token consumption.

Approach 3: Direct Gateway (TeamoRouter -- Recommended)

TeamoRouter is a unified LLM gateway that takes a fundamentally different approach. Rather than proxying through individual relay accounts, it maintains direct, high-quality upstream channels with end-to-end cache preservation. It is designed specifically for agent workloads, where prompt caching integrity is critical.

How TeamoRouter Differs from Relay Stations

Aspect Relay Station TeamoRouter
Upstream model Account pool rotation Direct premium channels
Prompt caching Often broken (account switching) >99% cache hit rate
Accessibility Usually requires proxy anyway Directly accessible from China
Model selection Claude only (usually) Claude + GPT + Gemini + DeepSeek
Pricing model Fixed discount rate Floating rate (10-20% of official)
VPN required Sometimes No
Enterprise features Rare Admin console, budget control, 99.6% SLA
Payment methods Cryptocurrency, limited options Alipay, WeChat, bank transfer

Setting Up TeamoRouter for Claude Access

Step 1: Create an account and get your API key

Go to teamorouter.com, sign up, and generate an API key from the dashboard. Top up your balance via Alipay or WeChat Pay.

Step 2: Configure your environment

bash
# TeamoRouter Anthropic-compatible endpoint
export ANTHROPIC_BASE_URL="https://api.teamorouter.com/anthropic"
export ANTHROPIC_API_KEY="tr-your-key-here"

Step 3: Use Claude normally

Your API client (Claude Code, Python SDK, or any Anthropic-compatible client) now routes through TeamoRouter automatically. No VPN, no additional proxy, no configuration changes needed beyond the environment variables above.

For more on the gateway's capabilities, see TeamoRouter's AI API gateway, which covers the full model catalog, rate limits, and advanced routing features.

Configuring Claude Code with a Proxy

If you prefer to use a traditional HTTP proxy with Claude Code instead of (or in addition to) a gateway, here is how.

HTTP/HTTPS Proxy

Claude Code respects the standard HTTP_PROXY and HTTPS_PROXY environment variables:

bash
export HTTP_PROXY="http://127.0.0.1:7890"
export HTTPS_PROXY="http://127.0.0.1:7890"
export ANTHROPIC_API_KEY="tr-your-key-here"
claude

This routes API requests through your local proxy server (e.g., Clash, V2Ray, or a corporate proxy). Note that this adds the same latency issues as a VPN and may not be necessary if you are using a gateway like TeamoRouter that is directly accessible from China.

SOCKS5 Proxy

For SOCKS5 proxies, set the following:

bash
export ALL_PROXY="socks5://127.0.0.1:1080"
export ANTHROPIC_API_KEY="tr-your-key-here"
claude

Testing Your Proxy Configuration

Run a quick test to confirm your proxy and API key are both working:

bash
claude -p "Respond with only the word 'connected'."

If you get a response, everything is configured correctly. If you get a timeout or connection error, check that your proxy is running and the port is correct.

Configuring Claude Web Access in China

For the browser-based Claude Web interface at claude.ai, your options are:

  1. VPN: The simplest solution. Connect to a VPN server in a supported region, then open claude.ai in your browser.

  2. Browser proxy extension: Use a browser extension like SwitchyOmega to route only claude.ai and anthropic.com traffic through a proxy, leaving other sites unaffected.

  3. System proxy: Configure your operating system's proxy settings to route traffic through a local proxy server (Clash, V2Ray, etc.).

Browser Proxy Setup with SwitchyOmega

  1. Install the SwitchyOmega extension for Chrome or Edge.
  2. Create a new profile with your proxy server details.
  3. Add a rule that routes *.claude.ai and *.anthropic.com through the proxy.
  4. All other websites continue to use your direct connection.

This approach gives you fine-grained control and avoids routing your entire browser through a VPN.

Common Issues and Troubleshooting

Issue: "Connection timed out" or "Cannot reach api.anthropic.com"

Cause: The Anthropic API endpoint is blocked or unreachable from your network.

Solutions:

  • Use a gateway like TeamoRouter that has a China-accessible endpoint.
  • Enable your VPN or proxy before starting Claude.
  • Check that your ANTHROPIC_BASE_URL points to your proxy/gateway, not the default api.anthropic.com.

Issue: Requests work sometimes but fail intermittently

Cause: Your VPN or proxy connection is unstable, or your relay station is experiencing upstream account rotation.

Solutions:

  • Switch to a more stable VPN server.
  • Try a direct gateway like TeamoRouter for consistent connectivity.
  • If using a relay station, verify your prompt cache hit rate in the usage dashboard.

Issue: High token consumption despite low per-token pricing

Cause: Your proxy or relay station is breaking prompt caching.

Diagnosis: Check your usage dashboard for cache hit rate. If cache reads account for less than 50% of input tokens, your caching is broken.

Solution: Switch to a provider that preserves prompt caching integrity, such as TeamoRouter.

Issue: "403 Forbidden" or "Access denied from your region"

Cause: Anthropic is blocking requests from known VPN or proxy IP addresses.

Solutions:

  • Try a different VPN server or provider.
  • Use a dedicated gateway (TeamoRouter) that uses premium upstream channels not subject to regional blocks.
  • Contact your provider to check if they offer Claude-specific optimized routes.

Issue: Claude Web loads but conversations fail mid-response

Cause: The WebSocket connection used for streaming responses is less stable on some proxies.

Solutions:

  • Try the Claude Desktop app, which may handle reconnection better.
  • Use the API through a gateway instead of the Web interface for more reliable streaming.
  • Switch to a VPN with better WebSocket support.

Choosing the Right Proxy Approach

Your Situation Recommended Approach
Just browsing claude.ai occasionally VPN or browser proxy extension
Using Claude Code daily for development Direct gateway (TeamoRouter)
Building a production app that calls the Claude API Direct gateway (TeamoRouter)
Already have a reliable VPN and want simplicity VPN + TeamoRouter key for cost savings
Using multiple AI tools (Claude + GPT + Gemini) Direct gateway (TeamoRouter), one key for all
Team or enterprise deployment TeamoRouter with enterprise admin console
Budget relay station user, costs creeping up Switch to TeamoRouter for cache integrity

FAQ

Do I need a VPN to use Claude in China?

Not necessarily. While a VPN works, a direct gateway like TeamoRouter provides API access that is reachable from mainland China without a VPN. For the Claude Web interface (claude.ai), a VPN or browser proxy is still needed unless you use the API through a locally accessible gateway.

What is the difference between a relay station and a direct gateway?

A relay station is a middleman that forwards your API requests using pooled upstream accounts. This often breaks prompt caching, which can silently multiply your costs. A direct gateway like TeamoRouter maintains dedicated upstream channels with end-to-end cache preservation, giving you reliable performance and predictable costs.

Will a proxy slow down Claude Code?

A traditional VPN or HTTP proxy adds latency (50-200ms per request). For agentic workflows, this can be noticeable because each agent turn involves multiple API round trips. A direct gateway like TeamoRouter is designed for low latency (TTFT close to going direct) and does not add a proxy layer, so agentic workflows feel responsive.

Can I use a free proxy for Claude?

Free proxies are not recommended. They are often slow, unreliable, and may log your API traffic (including your API key and conversation content). If cost is a concern, TeamoRouter provides accessible pricing with Alipay/WeChat support at 10-20% of official rates, making it more affordable than paying for both a VPN subscription and direct Anthropic pricing.

How do I know if my prompt caching is working?

Check your API usage dashboard. Look for the ratio of cache-read tokens to total input tokens. If cache reads account for most of your input tokens, caching is working. If cache reads are low or zero, your caching is broken. TeamoRouter's dashboard provides a dedicated cache-hit-rate metric so you can monitor this directly.

Does TeamoRouter work with Claude Code's latest features?

Yes. TeamoRouter is 100% protocol-compatible with Claude Code's full feature set, including tool calling, extended thinking, streaming, vision, computer use, and all beta features. It matches the Anthropic API spec exactly, so no feature is silently degraded.

Can I switch from a relay station to TeamoRouter without changing my code?

Yes. The migration is a two-line change: update ANTHROPIC_BASE_URL to your TeamoRouter endpoint and ANTHROPIC_API_KEY to your TeamoRouter key. All your existing code and tools continue to work without modification.

Ready to connect?Log in · top up · create an API key — three steps to start.
Claude Proxy Setup for China Users 2026: Complete Configuration Guide | TeamoRouter · TeamoRouter