Codex and Claude Code both work from mainland China, but neither OpenAI nor Anthropic lets you sign up or pay from there. So the real question is which obstacle you route around: the card, the network, or the account itself. There are four routes people actually use. Here is each one: how it works, what it costs, how stable it is, the ban risk, privacy, and who it suits.
Every route gets the same five checks: setup effort, long-term stability, ban risk, privacy (who can see your prompts and key), and cost.
Why you can't just use it
- Mainland China, Hong Kong and Macau are not on OpenAI's list of supported regions; Taiwan is. The list says that using OpenAI from anywhere else may get your account blocked or suspended.
- OpenAI goes by your IP address. Calling its API from a mainland or Hong Kong connection returns a 403 with the code
unsupported_country_region_territory. It has blocked API traffic from these regions since July 2024. - Claude Code is in the same position: Anthropic's supported regions leave out the same three, and say that using Claude while physically there counts too.
- So Codex the tool installs and runs fine. What stops you is signing in and paying, which go through OpenAI. The four routes below are four ways around that.
What Codex is: four ways in, one config
Codex is OpenAI's coding agent: you describe a task in plain words, and it reads the code, edits files and runs commands. It comes as the open-source Codex CLI (Apache-2.0), desktop apps for macOS and Windows, extensions for VS Code and other editors, and Codex on the web. The first three read the same config file, ~/.codex/config.toml, so the model behind them can be someone else's; the web version only runs OpenAI's models.
You sign in either with a ChatGPT account (every ChatGPT plan includes some Codex use) or with an API key billed by usage. Switching the model uses the second: put another provider's address and key in the config, and Codex no longer needs an OpenAI account. One catch: since February 2026, Codex only speaks the Responses API, so providers that only offer the older Chat Completions API no longer work. DeepSeek's own API and HaryAI both support the Responses API.
The short version
- You already have a foreign card and a stable connection → route 1, the official subscription.
- Saving money matters most and you don't mind tinkering → route 2, region-switched app stores and gift cards.
- You want the cheapest possible trial and accept the risk → route 3, resellers and shared accounts.
- You don't need GPT or Claude specifically, and want it cheap and without a foreign card → route 4, keep the tools and switch the model to DeepSeek.
Route 1: the official subscription (foreign card + your own network)
Sign up at openai.com or anthropic.com, add a card that their payment system accepts, keep a stable connection, and subscribe: a paid ChatGPT plan for Codex, a paid Claude plan for Claude Code. The CLIs then sign in with that account, or with an API key from it.
The hard part is getting in. Chinese dual-currency cards are often declined, so most people end up with a virtual or overseas card, and the connection is yours to maintain.
- Setup: hard. Card and network both need solving, and keep needing it.
- Stability: the model side is as stable as it gets; your access side is the weak link.
- Ban risk: medium. Mismatched signup country, payment method and IP can trigger reviews.
- Privacy: best. Nothing sits between you and the vendor.
- Cost: list price. Subscriptions come with 5-hour and weekly usage limits; when you hit them, you wait for the reset.
- Suits: people who already have the card and the connection.
Route 2: region-switched app stores and gift cards
Instead of a credit card on the vendor's website, you pay through an in-app purchase in the ChatGPT or Claude mobile app. The money comes out of your App Store or Google Play balance, which you top up with gift cards bought for RMB on Taobao or Xianyu. Prices vary by store region, so guides pick cheaper regions such as Nigeria or Turkey: switch your Apple ID to that region, buy that region's gift cards, then subscribe in the app.
- Setup: fairly hard. A foreign-region account, the right gift cards, and Apple's limits on switching regions.
- Stability: medium. Regional prices and exchange rates move, and foreign-region accounts can get flagged.
- Ban / money risk: medium. Gift cards carry a markup, and fake cards exist.
- Privacy: good. The subscription is on your own account.
- Cost: in the right region, at or below list price. The cheapest way to GPT or Claude if you put in the work.
- Suits: people who want near-list prices and will maintain a foreign-region account.
Route 3: resellers and shared accounts
A third party sells you a relay key and endpoint, a ready-made account, or top-ups. It's cheap, instant and paid in RMB. It's also where most of the horror stories come from: substituted models (a cheaper model answering as Claude or Codex, hard to spot), and shared accounts banned in bulk, taking everyone on them offline at once. Your requests pass through the reseller, who can read and log them.
- Setup: easiest. Pay and paste.
- Stability: uneven. Substituted models and mass bans are the known failure modes.
- Ban risk: high, and out of your hands on a shared account.
- Privacy: the biggest concern on this list.
- Cost: lowest on paper, before you count the failures.
- Suits: a quick, cheap trial by someone who knows the trade-offs.
Route 4: keep the tools, switch the model to DeepSeek
Codex and Claude Code are tools, and you can change the model behind them. Codex calls models through the Responses API, Claude Code speaks Anthropic's API format, and DeepSeek supports both natively. So route 4 doesn't go after GPT or Claude at all. It points the two tools at DeepSeek instead. The OpenAI and Anthropic signup, the foreign card and the foreign-region account that routes 1 to 3 work around don't come up. The trade-off is just as plain: the work is done by DeepSeek V4.1 Flash or V4 Pro, not by GPT or Claude.
There are two ways to get DeepSeek. One is DeepSeek's own API: you can sign up from mainland China and pay in RMB. The other is HaryAI: the same DeepSeek models at 55% off the official price. The key is yours alone, top-ups start at $10 and take Alipay and WeChat Pay, and if you use it every day there's a monthly Coding Plan from $20, card only.
With HaryAI, import your key into CC Switch from your account page, once for Codex and once for Claude Code, or edit ~/.codex/config.toml and ~/.claude/settings.json yourself. Every step is in DeepSeek in Codex and Claude Code.
- Setup: easy. Sign up, get a key, import it into CC Switch. No foreign card, no foreign-region account.
- Network: DeepSeek's own API connects directly from mainland China. HaryAI's gateway is in Singapore and is reachable from mainland networks without a VPN; coding sends text, which is small, so speed matters little. Try the smallest top-up first if you want to be sure.
- Stability: good. The key is yours and no account is shared.
- Ban risk: the lowest. You don't touch an OpenAI or Anthropic account, so there is nothing to ban.
- Privacy: DeepSeek's own API is direct. With HaryAI, requests pass through its gateway, and whether you trust the operator is your call.
- Cost: low, and you pay for what you use. DeepSeek's list price is already far below GPT's and Claude's API prices, and HaryAI is 55% off that.
- Suits: anyone who cares about price and convenience and is fine with DeepSeek doing the work instead of GPT or Claude, and anyone who has hit the official limits and wants DeepSeek to fill the gap.
Can DeepSeek actually code?
In the model card for its October update of V4.1 Flash, DeepSeek published coding and agent benchmarks against OpenAI's GPT-5.6 Sol and Anthropic's Claude Opus 5:
- Terminal-Bench 4.0 (finishing tasks in a terminal on its own): DeepSeek 42.3, GPT-5.6 Sol 39.9, Claude Opus 5 51.8.
- DeepSWE v1.1 (software engineering tasks): DeepSeek 77.0, GPT-5.6 Sol 73.0, Claude Opus 5 74.0.
- ProgramBench: DeepSeek 29.1, GPT-5.6 Sol 23.0, Claude Opus 5 37.0.
These are DeepSeek's own numbers on tests it chose, so read them as a rough guide. What they suggest: for everyday writing and fixing of code, DeepSeek V4.1 Flash is in the same league as GPT and ahead on some tests, while Claude Opus 5 still leads on the hardest, longest tasks. The other model, DeepSeek V4 Pro, is stronger at reasoning and planning but can't read images. The best test is your own project: run a few tasks on each, which the smallest top-up covers.
One more thing
Hitting the official limits doesn't mean switching routes. When the 5-hour or weekly limit runs out, you can wait for the reset, or switch to DeepSeek in CC Switch until it resets and then switch back. When OpenAI has reset limits early, and how often, is tracked in the Codex reset tracker and the Claude reset tracker.







