Using Codex from China: config, models and Alipay top-ups
As of 2026-10-13, running Codex CLI from mainland China comes down to two things. The first is coverage: the list of API-supported countries and territories on developers.openai.com has no mainland China entry, and the help.openai.com article on the same topic, in the 2026-10-07 archive copy fetched here, states that OpenAI publishes no separate list of unsupported countries and territories and that if a location is not included in the list below, its API is not supported there. The second is payment. On the Codex CLI side the official route is a custom model provider: in ~/.codex/config.toml the top-level model_provider points at a table you define under model_providers, with base_url, wire_api and env_key. With QCode, base_url is https://api.qcode.cc/openai and model is gpt-6.1-sol, gpt-6-sol, gpt-5.6-sol or gpt-5.6-terra, all four callable on QCode; top up with Alipay, WeChat Pay or Visa / Mastercard / AMEX. Billed per token; per-model rates are listed on /models.
Updated 2026-10-13
Want to sell it yourself? Validate the full flow with one key first — white-label and reseller come after.
- Billed per token — live rates on /models
- Pay by card (Visa / Mastercard / AMEX), Apple Pay, Google Pay or crypto
- Self-service: top up and activate instantly
Four values to get right first
The wire_api value
The official configuration reference says responses is the only supported value and is also the default when omitted; the QCode Codex guide writes wire_api = "responses" too.
The Codex base_url
QCode's docs require the Codex base_url to be exactly https://api.qcode.cc/openai, with no /v1 and no trailing slash; Codex travels over the Responses protocol path.
How QCode keys start
QCode's guide states keys start with cr_ and its first troubleshooting check is exactly that; env_key holds the name of the variable that stores the key, and the official docs say that variable name is not a fixed Codex environment variable.
CNY top-up minimum
The payment methods page repeats the limits printed on the top-up screen: CNY top-ups start at ¥100 and USD top-ups run from $1 to $2,000; the site's Alipay page adds a ¥2,000 per-payment cap for Alipay and about ¥900 for WeChat Pay.
Where using Codex from China gets stuck
As of 2026-10-13 the OpenAI side has two separate official pages. The supported-countries page on developers.openai.com is headed "Countries and territories that currently support access to our API services", and mainland China does not appear in that list. The help.openai.com article on the same subject, in its 2026-10-07 archive copy, carries two further sentences: "We do not publish a separate list of countries and territories that we do not support" and "If a location is not included in the list below, our API is not supported there". This page quotes those sentences as they stand and infers nothing beyond them. The second issue is payment: Alipay and WeChat Pay are what people in mainland China actually use, and QCode accepts both, along with cards, Apple Pay, Google Pay and cryptocurrency. The CLI side is covered by official documentation: a model provider defines how Codex connects to a model (base URL, wire API, authentication and optional HTTP headers), and you point model_provider at a table you define yourself. So the usual route is to keep the official CLI and point that provider at an endpoint that speaks OpenAI Responses and that you can pay for yourself: QCode's Codex base_url is https://api.qcode.cc/openai, billed per token, with per-model rates listed on /models.
What the official docs and QCode's docs say (fetched 2026-10-13)
In OpenAI's Codex docs custom providers cannot reuse the reserved built-in IDs openai, ollama and lmstudio; the authentication page says that setting requires_openai_auth = true makes Codex use OpenAI authentication, that Codex then ignores env_key, and that the option is useful when you access OpenAI models through an LLM proxy server, while the sign-in methods also include signing in with an API key for usage-based access; the sample configuration annotates requires_openai_auth as use only for providers backed by OpenAI auth. The environment-variables page says the variable named by that config is not a fixed Codex environment variable. On the QCode side the full Codex guide was updated on 2026-10-08 and the payment methods page on 2026-10-01, and the /models rows describe gpt-6-sol as the new flagship OpenAI released on 2026-09-22 and gpt-6.1-sol as the GPT-6 Sol update released on 2026-09-29.
The three dates this page rests on
OpenAI's own changelog carries the entry "Released GPT-6 Sol (gpt-6-sol)", dated Sep 22 under the September, 2026 heading; the /models row describes it as the new flagship released by OpenAI on 2026-09-22.
OpenAI's own changelog carries the entry "Released GPT-6.1 Sol (gpt-6.1-sol)"; the /models row and QCode's Codex guide both label it the GPT-6 Sol update dated 2026-09-29.
QCode's full Codex guide was updated on 2026-10-08 and its payment methods page on 2026-10-01.
Confirmed vs not verified
Confirmed (verbatim in the official and QCode pages)
Verbatim in OpenAI's pages: the heading sentence of the supported-countries page on developers.openai.com, "Countries and territories that currently support access to our API services"; in the help.openai.com article archived on 2026-10-07, "We do not publish a separate list of countries and territories that we do not support" and "If a location is not included in the list below, our API is not supported there"; that a model provider defines how Codex connects to a model (base URL, wire API, authentication and optional HTTP headers); that custom providers cannot reuse openai, ollama and lmstudio; that responses is the only supported wire_api value and the default when omitted; that requires_openai_auth defaults to false and makes Codex ignore env_key when true; that personal defaults live in ~/.codex/config.toml and project .codex/ layers load only when you trust the project. Verbatim in QCode's docs: the Codex base_url must be https://api.qcode.cc/openai; keys start with cr_; when auth.json and the environment variable both exist auth.json wins, and switching to the environment variable means setting OPENAI_API_KEY in auth.json to null; the Responses path does not serve the Chinese model families; gpt-6.1-sol, gpt-6-sol, gpt-5.6-sol, gpt-5.6-terra and gpt-6-astra are callable on QCode; payment covers Alipay, WeChat Pay, cards, Apple Pay / Google Pay and cryptocurrency, with CNY top-ups from ¥100; the same key also works for Claude Code, and costs are calculated from actual token consumption rather than per tool.
Unverified and not published
Two things are not verified here. First, OpenAI states that it publishes no separate list of unsupported countries and territories, so there is no negative list to quote; this page only reports that the fetched list has no mainland China entry, plus the sentence that locations outside the list are not supported. Second, which Codex CLI version started accepting this provider syntax has not been checked release by release; QCode's guide itself says not to treat version numbers in documentation as current, to follow GitHub Releases and npm, and to check your own build with codex --version.
The two choices people mix up
Your own provider versus just setting openai_base_url
The official docs give two routes: if you only want to point the built-in openai provider at an LLM proxy, router or data-residency enabled project, they say you can set openai_base_url in config.toml instead of defining a new provider; if you want your own key variable and protocol settings, define a table under model_providers. QCode's guide uses the second form and does not document the openai_base_url route, so this page follows the second form as well. The official docs also state that built-in provider IDs cannot be overridden, so your table cannot be called openai.
Codex over Responses versus Claude Code over Anthropic
The two protocols are not interchangeable, and QCode's docs put it plainly: the protocol is decided by the request path, and not every model family can use every path. The Responses path that Codex uses serves the GPT family and does not serve the Chinese model families, Claude models only work over the Anthropic protocol, and GPT models cannot use the Anthropic endpoint. So in Codex you pick gpt-6.1-sol, gpt-6-sol, gpt-5.6-sol or gpt-5.6-terra, and for Claude you switch to Claude Code: QCode's docs say the same key also works for Claude Code, and costs are computed from actual token consumption rather than per tool.
Five steps to a working setup
① Install the CLI with npm install -g @openai/codex; follow GitHub Releases and npm for versions and check your own build with codex --version. ② Create ~/.codex (on Windows %USERPROFILE%\.codex); the official docs say your personal defaults live in ~/.codex/config.toml. ③ Write config.toml: the official examples put model and model_provider at the top level, then define a table under model_providers for that id with the fields name, base_url, wire_api, env_key and requires_openai_auth; for QCode set base_url to https://api.qcode.cc/openai and wire_api to responses, and QCode's example sets requires_openai_auth to true. The table name and the env_key variable name are yours to choose (this page uses qcode and QCODE_API_KEY), but the table cannot be called openai, ollama or lmstudio. ④ Supply the key: write the key that starts with cr_ into OPENAI_API_KEY in ~/.codex/auth.json, which is the first option in QCode's docs; if you prefer an environment variable, QCode's docs show setting it under the name you chose in env_key and setting OPENAI_API_KEY in auth.json to null, because auth.json takes priority when both exist. ⑤ Run one task to test; if it fails, check the two items on QCode's list first: is base_url exactly https://api.qcode.cc/openai, and does the key start with cr_? Watch token use with /cost.
Codex on QCode
Copy a key that starts with cr_ from the console, set base_url to https://api.qcode.cc/openai and wire_api to responses, and set model to gpt-6.1-sol, gpt-6-sol, gpt-5.6-sol or gpt-5.6-terra; these four are callable on QCode and switching only changes model. The Responses path Codex uses does not serve the Chinese model families, and Claude models only work over the Anthropic protocol, so for Claude you use Claude Code with the same key. Payment: for mainland China and CNY the payment methods page routes you to Alipay, with the fee not passed through, and WeChat Pay as the alternative, both crediting your CNY balance; Visa / Mastercard / AMEX, Apple Pay / Google Pay and cryptocurrency are supported too, crypto covers many coins and networks with on-chain transfers verified by hand, so a small test transfer is advised. CNY top-ups start at ¥100 and USD top-ups run from $1 to $2,000; after a top-up, activation is self-service and immediate. Billed per token; per-model rates are listed on /models.
Frequently asked questions
Can I use Codex from China, and what does the official list say?
The two OpenAI texts sit on different pages: the list of API-supported countries and territories on developers.openai.com has no mainland China entry, and the help.openai.com article archived on 2026-10-07 states that "If a location is not included in the list below, our API is not supported there" and that no separate list of unsupported countries and territories is published. This page quotes those sentences as written and draws no further conclusion. Configuration is a separate matter: the official docs show how to point model_provider at a provider table you define, connecting Codex to any endpoint that speaks Responses.
Which config.toml entries change?
Two places: the top-level model_provider points at your custom provider id, and you then define a table for that id under model_providers with base_url, wire_api and env_key. The official reference says responses is the only supported wire_api value and the default when omitted; env_key is the environment variable supplying the provider API key; requires_openai_auth means the provider uses OpenAI authentication, defaults to false, and makes Codex ignore env_key when it is true. You may name the table anything except openai, ollama or lmstudio, which the official docs say are reserved built-in IDs that cannot be overridden.
What goes in base_url, and does it include /v1?
For QCode it is https://api.qcode.cc/openai, with no /v1 and no trailing slash. QCode's guide states the Codex base_url must be exactly that value and that Codex uses the Responses protocol. The endpoints page adds that /api and /openai/v1 are path prefixes rather than standalone endpoints, and that SDKs append /v1/messages, /chat/completions or /responses themselves. In the official docs the base_url field means the API base URL for the model provider.
Can Codex call Claude or the Chinese model families on QCode?
No. QCode's docs say the protocol is decided by the request path and that not every model family can use every path: the Responses path Codex uses serves the GPT family and explicitly does not serve the Chinese model families, Claude models only work over the Anthropic protocol, and GPT models cannot use the Anthropic endpoint. So in Codex you use gpt-6.1-sol, gpt-6-sol, gpt-5.6-sol or gpt-5.6-terra, and for Claude you switch to a client that speaks Anthropic. QCode's docs state that the same key also works for Claude Code and that the key itself does not distinguish protocols.
How do I pay and activate from China?
Top up in CNY with Alipay or WeChat Pay, and activation after the top-up is self-service and immediate. The payment methods page routes mainland China and CNY payments to Alipay, with the fee not passed through, and WeChat Pay as the alternative; both credit the CNY balance. Its printed limits are CNY top-ups from ¥100 and USD top-ups from $1 to $2,000, while the site's top-up page lists a ¥2,000 per-payment cap for Alipay, about ¥900 per payment for WeChat Pay, whose checkout page also accepts cards. Other options: Visa / Mastercard / AMEX through the international checkout with the balance credited immediately, Apple Pay or Google Pay using the card already bound in your wallet, or cryptocurrency, which covers many coins and networks and is verified by hand after the on-chain transfer, so a small first transfer is advised.
How is it billed?
Billed per token; per-model rates are listed on /models. QCode's guide states that costs are calculated from actual token consumption and not per tool, and that the same key also works for Claude Code; which models are offered and at what rate follows the /models page. Use /cost for the tokens used in a session and the console for overall quota.
Sources
Every sentence on this page was re-fetched and checked word for word on 2026-10-13. OpenAI side: the supported-countries page on developers.openai.com, the 2026-10-07 archive copy of the same help.openai.com article, the OpenAI API changelog, and six Codex documents on learn.chatgpt.com (Configuration Reference, Advanced Configuration, Config basics, Environment variables, Authentication, Sample Configuration). QCode side: the Codex guide, the endpoints and API paths page and the payment methods page on docs.qcode.cc, plus five pages on qcode.cc: the home page, /models, /claude-code-china-guide, /codex-cli-third-party-api-setup and /alipay-wechat-pay-ai-api.
One key for Codex, topped up in CNY
Set base_url to https://api.qcode.cc/openai and model to gpt-6.1-sol or gpt-6-sol, top up with Alipay or WeChat Pay, and activation is self-service. Billed per token; per-model rates are listed on /models.
Related reading
How to Use Claude Code in China (Oct 2026): Alipay & WeChat
The Claude Code version of the same top-up and activation route: point ANTHROPIC_BASE_URL at QCode and pay with Alipay or WeChat Pay.
Codex CLI third-party API setup
model_provider, model_providers, base_url, wire_api and env_key in config.toml, line by line, with the common errors.
Paying for an AI coding API with Alipay and WeChat
Per-payment caps and settlement: Alipay up to ¥2,000, WeChat Pay around ¥900, and a ¥100 CNY top-up minimum.
Checked on 2026-10-13. OpenAI's supported-countries list, the Codex configuration fields and the protocol wording follow whatever the official pages say today, and OpenAI states it publishes no list of unsupported locations; QCode's configuration, payment options and printed amount limits follow docs.qcode.cc and the top-up pages, and model availability with per-model rates follows /models and can change without notice. Nothing here is a cost or availability commitment for your specific workload.