cocodot
← Back to guides
Local card declined for overseas AI? cocodot: one card + one key
AI APIUpdated 2026-08

GPT / Gemini API From China: One Key, Multiple Vendors — The Complete Method (2026)

Use GPT and Gemini without two overseas accounts: how one OpenAI-compatible key switches vendors, how far compatibility goes, and why not to hard-code IDs.

TL;DR: Using GPT and Gemini the official way means two accounts, two overseas cards that pass risk controls, two rounds of network and risk-control trouble — two sets of everything. The easier path is one OpenAI-compatible relay: one key, one balance, and switching the single `model` field calls different vendors' models on one interface, funded via Alipay. One boundary worth stating first: 'OpenAI-compatible' means the standard `chat.completions` set works (messages, temperature, streaming and other common parameters), while vendor-specific parameters are not necessarily passed through as-is, so cross-model code should depend only on common parameters. Also, do not hard-code model codes — models turn over fast; make them configuration so a model change is a config edit. Current codes are available from the public model-list endpoint; no need to memorize.

1. The real cost of onboarding two vendors

Name the pain precisely. Using GPT and Gemini the official way means the full process twice: two registrations, two overseas cards that pass risk controls, two top-ups, two sets of keys, two network arrangements. For developers in China the sticking point is card binding — the account registers, but the card is declined or a fresh top-up is flagged. Not an operator error: a structural issue of issuing-country risk scoring. And it is doubled. For anyone who just wants to 'get it working, compare, pick one', that overhead is out of proportion — time gone before the real work starts.

2. The approach: one interface, switch codes to switch vendors

The easier way is one OpenAI-compatible relay: one key, one balance, every vendor's models under one interface, selected via the `model` field. With cocodot the endpoint is `https://cocodot.co/api/ai/v1`; sign up, small Alipay top-up, create a key in the console, and you are calling — no overseas card. 'OpenAI-compatible' concretely means you keep the official OpenAI SDK, change only `base_url` and `api_key`, and your `chat.completions` code stays. The biggest win is not price but removing the 'open an account to try a model' startup cost — change a code to try a vendor, change it back if it disappoints, no sunk cost.

3. How far compatibility goes: a boundary to know

Most guides skip this, and it decides whether your code hits a trap. 'OpenAI-compatible' covers the standard set: the messages array, temperature, max length, streaming and other common parameters, plus the standard response shape. Vendor-specific parameters and capabilities are not necessarily passed through as-is — those belong to the vendor's own interface, not the OpenAI standard. So write cross-model code on one principle: depend only on common parameters. Then the same code runs with any `model` code, which is the precondition for comparison and failover. If your business truly depends on one vendor's proprietary capability, honestly assess using its native interface — do not expect the compatibility layer to fill in every proprietary feature. That is a trade-off, not a defect.

4. Model codes: do not hard-code, query

Models turn over quickly, and any 'code = model' table goes stale — in an article or in code it is a liability. The reliable move is to query the current list — such platforms expose the OpenAI-standard model-list endpoint, and cocodot's is public, no key required: ```bash curl https://cocodot.co/api/ai/v1/models ``` It returns a standard-format list; copy the `id` you want into the `model` field. Better still: do not hard-code codes — make them configuration or environment variables. A model change becomes a one-line config edit with no code change or redeploy; a temporarily unavailable model is likewise a config switch. With models iterating this fast, the habit pays off quickly.

5. Running a comparison without opening many accounts

Do not choose by others' reviews — run your own real tasks. Public leaderboards reflect general ability, while your scenario has specific preferences (Chinese expression, long documents, structured output, instruction following). With every model on one interface, comparison is simple: prepare a set of your most typical inputs (twenty or more, covering common and edge cases), write a loop, run the same input across several `model` codes, record outputs and latency, then judge by eye. Formerly this required accounts at several vendors; now one balance does it. Beyond quality, also record response speed and output stability — in many scenarios those affect experience more than absolute quality.

6. Tier by task; do not put everything on the priciest model

The most effective cost control is not cutting usage but allocating models by task difficulty. Real calls fall into roughly three classes: simple structured tasks (classification, field extraction, format conversion, intent detection) — a cheap small model is plenty and the end result barely differs; general generation (summaries, rewrites, ordinary Q&A) — mid-tier; genuinely demanding tasks (complex reasoning, long-document analysis, code) — the only ones worth a flagship. Many bills are inflated by the first class because everything was sent to the most expensive model. Since switching is one field, tiered routing costs almost nothing: choose a config entry by task type — often the fastest-paying optimization.

7. Self-checks before and after integration

Practical items that save debugging time: ① base_url must end with `/v1` — omit it and everything 404s, the most frequent misconfiguration; ② top up small and complete one real call before scaling; balance must exceed 0 to call, there is no free allowance; ③ add timeouts and retries — model calls are much slower than ordinary APIs and default timeouts often fall short; enable streaming for long answers to improve both experience and timeout risk; ④ log model, latency and usage per call, so when something breaks you can immediately say which model slowed down and when; ⑤ keep keys in environment variables, never in frontend code or the repository; one key per project so revocation is precise.

Same code, different vendor: what changes and what does not

TaskHowNote
Switch to another vendor's modelChange only the `model` fieldInterface, auth and SDK untouched
See which models are availableFetch /v1/models (public)Do not rely on a hard-coded table; it goes stale
Run a comparisonLoop the same input over several modelsOne balance, no separate accounts
Failover when a vendor wobblesChange one model code in configProvided the code uses only common parameters
Control costSimple tasks on cheaper modelsTier by task; not everything on the most expensive

FAQ

Can one key really call both GPT and Gemini?

Yes. Such relays put different vendors' models under one OpenAI-compatible interface; with the OpenAI SDK you change only base_url and api_key, then switching vendors is changing the model field — auth and call code untouched, one balance for all.

Does 'OpenAI-compatible' mean every feature is identical?

No — know this boundary. Compatibility covers the standard chat.completions set (messages, temperature, max length, streaming and other common parameters). Vendor-specific parameters and capabilities are not necessarily passed through as-is. Write cross-model code on common parameters only; if you rely heavily on one vendor's proprietary features, evaluate its native interface.

How do I look up model codes, and do they go stale?

They go stale, so do not use a hard-coded table. Fetch the public model-list endpoint: curl https://cocodot.co/api/ai/v1/models (no key) and copy the id into the model field. Better, make codes configuration rather than hard-coding them.

How do I pick which model to use?

Run your own real tasks, not just public leaderboards. Prepare twenty-plus typical inputs, loop the same input over several model codes, record output and latency, and compare by eye. On one interface this takes one balance and no separate accounts. Also watch response speed and output stability.

How do I bring API cost down?

Allocate models by task difficulty: classification, extraction and format conversion on cheap small models; summaries and rewrites on mid-tier; complex reasoning, long documents and code on flagships. Many bills are driven by simple tasks sent to the priciest model. Switching is one field, so tiering is cheap.

What is the most common integration mistake?

Omitting /v1 from base_url, which 404s every request. Next: calling with no top-up (balance must exceed 0, no free allowance), timeouts set too short (use streaming for long answers), and putting the key in frontend code or the repository.

About cocodot

cocodot is a payment and AI access service for developers and cross-border teams in mainland China. It provides US-BIN virtual cards issued by a licensed institution — used to pay for overseas subscriptions and ad accounts — and an OpenAI-compatible AI API gateway for calling Claude, GPT and Gemini from within mainland China. Both share one wallet, funded by Alipay and accounted in USD. Card: $9.9 to open, 3% to load, $1 per active card per month; spending: $0.60 settlement fee on purchases under $20; a corresponding fee applies when the issuer charges one.

Service scope, pricing and limits →
GPT and Gemini API From China: One Key, Multiple Vendors