You create an OpenAI API key in the OpenAI platform on the API keys page, and only the account owner can do it. If your payment is not accepted, you have two routes. One is to fix the payment instrument on OpenAI's side, which means a card issued by a bank in a supported country. The other is to take a key from a third-party provider that serves OpenAI models through a compatible API. The second route is a different deal with a different service, not an OpenAI key. The rest of this piece explains how the two differ and when each one makes sense.
Where OpenAI creates the key
The OpenAI quickstart gives this order.
- Open the platform at
platform.openai.com/api-keys. The quickstart links it under "Create an API Key". - Create a secret key and store it at once. OpenAI's help page says the full key is displayed only when you create it. Lose it and you create a new one and update your app.
- Put the key in the
OPENAI_API_KEYenvironment variable:export OPENAI_API_KEY="your_key"on macOS and Linux,setx OPENAI_API_KEY "your_key"on Windows. The OpenAI SDKs read it on their own.
ChatGPT and the API are separate products with separate billing. OpenAI's billing page says API credits are tied to an API organization and are independent of a ChatGPT subscription. So a paid ChatGPT plan does not by itself give you API access, and the reverse holds too. There is one exception. Subscribers on Pro (the $100, $200 and $500 tiers) and on Business workspaces with paid seats can activate monthly API credits for a linked API organization once the plan has been active for 7 days. Billing stays separate, Plus does not qualify, and OpenAI says availability depends on the country and the enabled cohort.
OpenAI's key-safety page adds the rules worth following from day one: every teammate gets a personal key (sharing keys is against the Terms of Use), keys never go into browser or mobile code or into a repository, and new keys should carry an expiry date and be rotated on a schedule.
How the API balance works
New API accounts use prepaid billing: you buy credits first and the balance drops as you send requests. In the billing overview you choose Add payment details, then an amount. The minimum is $5 and the default is $10. Auto-reload is switched on by default during setup, so turn it off if you do not want automatic charges. The balance can take a few minutes to update after a purchase.
Other points from the prepaid-billing page:
- Purchased credits expire after one year, and OpenAI cannot extend them. Credits are non-refundable. The page lists exceptions: a verified billing error, confirmed unauthorized charges, a confirmed service failure or a wrong account restriction on OpenAI's side, and cases where law or contract requires a refund.
- The maximum balance depends on your trust tier, which comes from usage and payment history.
- If the account has free credits, they are spent first.
- When credits run out, the API answers with a billing error whose code is
credit_balance_exhausted.
Why a payment gets declined
OpenAI's help article "Why was my credit card declined?" names three groups of causes. We paraphrase it as of 10 November 2026.
| Cause | What the page says | What to check |
|---|---|---|
| The bank declined | banks sometimes block online or international payments by default, and OpenAI usually does not receive a detailed reason | card details and billing address, the 3-D Secure prompt, a call to the bank |
| A prepaid card | prepaid cards cannot buy API credits, only standard credit or debit cards | the card type with your issuer, since many virtual cards are prepaid |
| Region or issuing bank | purchases work only in supported countries, and the card must be issued by a bank in one of them | OpenAI's country list |
The country list sits on the page "OpenAI API - Supported Countries and Territories". On 10 November 2026 it has 208 entries. Kazakhstan, Armenia, Georgia, Uzbekistan, Turkey, the UAE, India, Nigeria, Pakistan, Indonesia, the Philippines, Mexico, Brazil, Vietnam and Egypt are on it. Russia, Belarus and China are not. OpenAI keeps no separate list of unsupported places: a location missing from the list is a place where the API is not supported. The page also warns that reaching the services from outside the list may lead to a blocked or suspended account.
If your country is on the list and the card still fails, the first two rows of the table are the likely culprits. If your country is not on the list, no card setting fixes it. We do not publish tricks for faking a country or a card, because by OpenAI's own page that can cost you the account.
What an OpenAI-compatible key is
A service is called OpenAI-compatible when it accepts requests in OpenAI's API format: a path like /v1/chat/completions, an Authorization: Bearer <key> header, the usual model and messages fields. The openai library then works without code changes. Two values change: base_url and the key.
| OpenAI key | Claudexia gateway key | |
|---|---|---|
| Issued by | OpenAI | Claudexia |
| Created in | OpenAI platform, API keys page | Claudexia dashboard, API Keys section |
| API address | https://api.openai.com/v1 | https://api.claudexia.tech/v1 |
| Key format | whatever the OpenAI platform issues | sk_cdx_... |
| Payment | prepaid from $5, card from a bank in a supported country | top-up from $1: local cards, SBP, crypto |
| Terms | OpenAI's agreement and policies | Claudexia's terms plus the policies of the model providers |
| Models | OpenAI's catalog | GPT, Claude, Gemini, DeepSeek and others behind one key |
The keys are not interchangeable: an sk_cdx_... key will not open api.openai.com, and an OpenAI key will not be accepted at our address.
Two situations make a compatible key worth a look. The first is the payment problem above, where a provider that takes SBP (the Russian instant bank-transfer system), local cards or crypto removes the card step. The second has nothing to do with payments: you want one key and one balance across several model families and plan to compare them on your own tasks. On 10 November 2026 the catalog at GET /v1/models lists gpt-6-astra, gpt-6.1-sol, gpt-6.1-terra, gpt-6-sol, gpt-6-luna, gpt-5.6-sol, gpt-5.6-terra, gpt-5.6-luna and the image models gpt-image-2, gpt-image-2-5, gpt-image-2-6, next to Claude and other families. The catalog changes, so the current list and prices live on the models page.
How to connect a gateway key
Sign up with a login and password, or with Google, GitHub or Telegram. Top up from $1 with local cards through YooKassa or Platega, with SBP, or with crypto through CryptoCloud, CryptoBot or the 2328 service (USDT, BTC, ETH, TON and others). For people outside Russia, crypto is the method that does not depend on a bank, and Paying for API access with crypto covers when it beats a card. Then create a key in the API Keys section. Both kinds of keys, Anthropic's and ours, are compared in How to get a Claude API key and where to put it.
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.claudexia.tech/v1",
api_key=os.environ["CLAUDEXIA_API_KEY"],
)
reply = client.chat.completions.create(
model="gpt-6-sol",
messages=[{"role": "user", "content": "What separates a 401 from a 403? Two sentences."}],
)
print(reply.choices[0].message.content)
The same in Node and TypeScript:
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.CLAUDEXIA_API_KEY,
baseURL: "https://api.claudexia.tech/v1",
});
const reply = await client.chat.completions.create({
model: "gpt-6-sol",
messages: [{ role: "user", content: "What separates a 401 from a 403? Two sentences." }],
});
console.log(reply.choices[0].message.content);
Comparing models is then a one-word edit: change the model string and keep everything else. For an existing app, swap OPENAI_BASE_URL for https://api.claudexia.tech/v1, the key and the model ID. To check the key itself, send a request that needs one. GET /v1/models does not: on 10 November 2026 it returned the catalog with no key at all and with a made-up one. A short chat call on a cheap model does need it:
curl -s -w "\nHTTP %{http_code}\n" https://api.claudexia.tech/v1/chat/completions \
-H "Authorization: Bearer $CLAUDEXIA_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "gpt-5.6-luna", "messages": [{"role": "user", "content": "Reply with one word: ok"}]}'
A working key gets HTTP 200 and a reply. A wrong or missing key gets HTTP 401 with authentication_error, which is what we saw on the same date with no key and with a made-up one. The call is billed like any other: at the catalog rate on that date, $0.04 per 1M input and $0.20 per 1M output tokens for gpt-5.6-luna, it costs a fraction of a cent. The catalog request, curl https://api.claudexia.tech/v1/models, is still the quick way to look up model IDs.
If a client complains about an unknown model, the usual cause is a typo in the ID or a base URL without /v1. Moving an existing codebase is covered in Moving to the OpenAI-compatible format.
OpenAI's rules for intermediaries from 20 November 2026
OpenAI updated its Usage Policies on 21 October 2026, effective 20 November 2026. The help page about the update lists four changes, and one of them is an approval requirement for model-access intermediaries. In the policy text it sits under "Providing access to our models": an operator of an intermediary platform, or any other service through which third parties access OpenAI models directly, must get OpenAI's prior review and approval. An application that merely builds OpenAI models into its own features is not covered by the rule on that ground alone.
Gateways, Claudexia included, fit the description of a service through which third parties reach OpenAI models. OpenAI decides case by case. We found neither criteria nor a list of approved services in the policy text or in the help page on 10 November. We do not report anyone's approval status, and we do not promise that access to OpenAI models through any intermediary stays as it is today. If your product depends on it, ask the provider directly how it handles the new rules, and keep a fallback: models from another family in the same catalog, or a direct account if your country and bank allow one.
Before paying, open the provider's catalog and terms. A model listed today is not a promise that it will be listed tomorrow.
What a gateway does not replace
- An OpenAI account and agreement. Organizations and projects, trust tiers and limits, invoices for your accounting team, and OpenAI support all stay with an OpenAI account.
- Anything absent from our documentation. It describes
POST /v1/chat/completions,GET /v1/models, image and video generation, and the Responses format for Codex. For Realtime, fine-tuning and Assistants, the OpenAI comparison in our docs tells you to go to OpenAI directly, and we have no documentation for Batch, so treat it as unavailable until you test it. - ChatGPT subscriptions and the chat interface. We do not sell ChatGPT plans or web chat access, only API.
- Your company's requirements. If your security policy demands a direct contract with the model vendor, an intermediary will not pass, however convenient the payment is.
Which route to take
| Situation | What fits |
|---|---|
| You hold a card from a bank in a supported country and want an agreement with OpenAI | an OpenAI key from the platform |
| You need local payments or crypto, or several model families behind one key | an OpenAI-compatible gateway, with the rules above in mind |
| You want the ChatGPT chat with voice and files | a ChatGPT subscription, a different product |
| You need Realtime, fine-tuning or Assistants | OpenAI directly |
| Your code is written for the OpenAI SDK and you want to test another model | change base_url, starting with the GPT-6 and GPT-5.6 comparison |
FAQ
How do I get an OpenAI API key?
Create it on the API keys page of the OpenAI platform. The key lives in an API account and is billed there. A ChatGPT subscription is not required, although eligible Pro and Business plans can activate API credits for a linked API organization.
Why is my card declined on the OpenAI API?
OpenAI names three causes: the bank blocked the payment, the card is prepaid, or the card was issued outside a supported country. Check the card type and issuer first, then the country list.
Is there a free OpenAI API key?
OpenAI's prepaid-billing page describes no free tier. It says only that free credits on an account, if any, are spent first. Your billing page shows whether you have some.
Can I buy an OpenAI API key from someone?
A key is created by the account owner. OpenAI's help page says sharing keys is against its Terms of Use. A key bought from a reseller belongs to someone else's account and can be revoked at any moment.
Is an OpenAI-compatible key the same as an OpenAI key?
No. A different service issues it, it works only at that service's address, and that service's terms apply. The request format is compatible. The agreement and policies are not.
Can I use the openai library with another provider's key?
Yes. Set base_url to the provider's address, such as https://api.claudexia.tech/v1, and use its key. Take the model ID from the provider's catalog.