How to Get an OpenAI API Key: Steps, Region Rules, Billing and First Request
TL;DR: Create an OpenAI API key in the API Dashboard at platform.openai.com, add billing credits, store it as OPENAI_API_KEY and test it with one curl request; mainland China is not a supported region.
OpenAI API keys are created in the API Dashboard at platform.openai.com. This guide covers the exact pages, who can sign up, how billing and usage tiers work, and a first request you can paste into a terminal.
Estimate your monthly API cost →All guides
Before you start: supported countries
OpenAI publishes a list of supported countries and territories. Mainland China, Hong Kong and Macau are not on it (Taiwan, Japan and Singapore are). OpenAI warns: “Accessing or offering access to our services outside of the countries and territories listed below may result in your account being blocked or suspended” (Supported countries).
Create the key
- Sign in to the API Dashboard at
https://platform.openai.com/login(or create an account there). - Open API keys:
https://platform.openai.com/api-keys. The same page is also reachable as Settings → Organization → API keys (https://platform.openai.com/settings/organization/api-keys). - Click Create an API Key, copy it, and store it in the
OPENAI_API_KEYenvironment variable — the official SDKs read it automatically (Quickstart).
There is also a separate Admin API key (on the admin-keys page) that is only for administration endpoints; for normal model calls use a regular API key (API overview).
Free usage, billing and usage tiers
OpenAI’s rate-limit page lists a Free tier whose condition is “User must be in an allowed geography”, with a $100 monthly usage limit. The quickstart calls the first request a “free test API request” and then points you to “Add credits to keep building” on the billing page (https://platform.openai.com/account/billing/overview). The pages we checked do not state a specific free-credit amount or the accepted payment methods.
| Tier | Qualification | Monthly usage limit |
|---|---|---|
| Free | User in an allowed geography | $100 |
| Build | $5 total paid | $500 |
| Launch | $100 total paid | $5,000 |
| Grow | $500 total paid | $200,000 |
Limits apply at the organization and project level; check yours under Settings → Organization → Limits (Rate limits). Before you top up, paste a typical prompt into the token counter and estimate a month of traffic with the LLM cost calculator.
Base URL and authentication
- Base URL:
https://api.openai.com/v1 - Header:
Authorization: Bearer $OPENAI_API_KEY - If you belong to several organizations or projects, you can add the
OpenAI-OrganizationandOpenAI-Projectheaders (API overview).
Hello world
The quickstart uses the Responses endpoint POST /v1/responses with the model gpt-6-astra:
export OPENAI_API_KEY="paste-your-key-here" # never commit this
curl https://api.openai.com/v1/responses \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{
"model": "gpt-6-astra",
"input": "Say hello in one sentence."
}'
# Several organizations? Add: -H "OpenAI-Organization: <org id>" -H "OpenAI-Project: <project id>"
Common gotchas
- Wrong region. Using the API from outside the supported list can get the account blocked or suspended — it is a policy issue, not something a new key fixes.
- Key in the browser. OpenAI says not to share the key or “expose it in any client-side code”. Call the API from your server.
- Hit a limit? Limits are shared by the organization and project, so other keys in the same project use the same budget. Higher tiers unlock as your total paid amount grows.
- Leaked key. Revoke it on the API keys page; OpenAI says revocation takes effect within seconds. Then create a new one. Put the key in an environment variable, keep it out of Git and out of any code that runs in a browser or mobile app, and replace it if it is ever exposed. The API keys overview has the full checklist.
FAQ
Is the OpenAI API free?
There is a Free usage tier (for users in an allowed geography, up to $100 a month in usage) and the quickstart describes the first call as a free test request. To keep using it you add credits on the billing page. The exact free-credit amount is not stated on the pages we checked.
Can I sign up from mainland China?
Mainland China, Hong Kong and Macau are not on OpenAI’s supported countries list, and OpenAI says access from outside the list may lead to blocking or suspension.
Where do I see my limits?
Settings → Organization → Limits in the dashboard.
Sources
Vendor features and prices were checked against these official pages on 2026-10-20. Products change; if something here no longer matches, the official page is right.
- OpenAI — Developer quickstart
https://platform.openai.com/docs/quickstart - OpenAI — Supported countries and territories
https://developers.openai.com/api/docs/supported-countries - OpenAI — API reference overview
https://developers.openai.com/api/reference/overview - OpenAI — Rate limits
https://developers.openai.com/api/docs/guides/rate-limits