When developers in mainland China call the ChatGPT or OpenAI API, the usual problems are unstable networking, restricted payment methods, account risk controls, invoices, and compliance. There are many "domestic access solutions" on the market, but not every one is suitable for an enterprise.

This article lays out the available paths, configuration methods, risks, and a test checklist. Please comply with OpenAI's terms of service and local laws and regulations.

Note: OpenAI and ChatGPT are trademarks of their respective owners. This article is intended for technical discussion only and does not constitute legal advice.

1. Start with your use case

Before choosing a path, answer a few questions:

  • Is this for personal learning or testing?
  • Will it be integrated into a company product?
  • Does it involve user data or personal information?
  • Do you need invoices or a contract?
  • Do you need to switch between multiple models?

Different scenarios call for different choices. For personal testing, a small prepaid balance is enough. For enterprise production, clear compliance and procurement first; the technical setup is usually the easy part.

2. Three common paths

Option 1: Direct official access

Base URL: https://api.openai.com/v1

This is suitable for teams that can access OpenAI reliably, already have an official account and payment method, and whose compliance requirements allow direct use.

Before committing, confirm account risk controls, the payment method, invoicing, and how cross-border data transfer is handled.

Option 2: A gateway reachable from mainland China

Base URL: https://ai.zhongshangqihang.com/v1

This is suitable for teams with unstable domestic access, or that need unified billing and quotas while using several model providers at once.

Choose a provider with clear terms, stable operations, and the ability to issue invoices. Test with a small amount before you move production traffic. See OpenAI API relay for a more detailed migration checklist.

Option 3: Self-hosted gateway

Run a gateway such as New API, One API, or LiteLLM yourself. You prepare the upstream channels, servers, monitoring, and operations. This suits companies with a technical team and strict data-control requirements. See One API and New API guide for the trade-offs.

3. Configuration example

The OpenAI SDK makes the switch a three-line change: replace the key, the base URL, and the model name.

from openai import OpenAI

client = OpenAI(
    api_key="sk-你的密钥",
    base_url="https://ai.zhongshangqihang.com/v1",
)

resp = client.chat.completions.create(
    model="gpt-5",
    messages=[{"role": "user", "content": "只回复 OK"}],
)
print(resp.choices[0].message.content)

Model names are subject to model pricing. Copy the current name from the pricing page instead of reusing an old name from a tutorial.

4. Compliance checklist

  1. Terms of service: confirm that your usage is permitted and does not involve prohibited content.
  2. Cross-border data: when personal information or important data is involved, complete a compliance assessment first.
  3. Content safety: public-facing products need review and filtering mechanisms.
  4. Invoices and contracts: enterprise procurement should follow company processes and keep records.
  5. Supplier qualifications: confirm upstream authorization, data terms, and how security incidents are reported.
  6. Do not use shared accounts or third-party top-ups of unknown origin. You bear the account-ban and data risks.

Compliance is not a one-time checkbox. Revisit it when your use case, data scope, or supplier changes.

5. Test checklist

  1. Standard and streaming requests.
  2. Tool calling and structured output.
  3. Long context.
  4. 5 and 10 concurrent requests.
  5. 401/404/429/5xx error codes.
  6. Bill reconciliation against a fixed set of requests.
  7. Continuous observation for 3–7 days.

A single successful request proves very little. The goal is to see how the path behaves under your real traffic shape, including retries and peak concurrency.

6. FAQ

Can I call the OpenAI API directly from mainland China?

It depends on your network, account, payment, and compliance conditions. Before enterprise use, confirm the terms of service and local regulations.

Will using a relay get my account banned?

It depends on upstream compliance and how you use the service. Choose a provider with clear terms and stable operations, and follow the rules.

Is a relay priced the same as the official service?

Not necessarily. Compare after including exchange rates, fees, retries, invoices, and operations costs.

What if I need an invoice?

Before purchasing, confirm whether the provider can issue invoices, what type, and on what schedule. A service without invoices is not suitable for enterprise reimbursement.

7. Risk notes

  • Do not buy "shared keys" of unknown origin.
  • Do not put API keys in frontend code.
  • Do not run company production traffic on a personal account.
  • Do not ignore cross-border data transfer and content safety.
  • Keep contracts, invoices, and usage logs for audits.

Next steps

If you need an entry point that is reachable from mainland China, has unified billing, and supports invoicing, sign up for the ZSQH AI Gateway, test with a small amount, and then follow the enterprise procurement process. Models and prices are subject to model pricing.

Related reading: