How to get an OpenAI API key: sign up, billing, first curl, and rate limits
Register on the OpenAI platform, set up billing, create an API key, send one curl request, and understand 429 rate-limit errors.
You want GPT in code, not only in the ChatGPT web app. The official path is platform.openai.com: sign up → set up Billing → create an API key → send your first curl to chat/completions. Steps follow the OpenAI Quickstart and Authentication docs.
The searchable job is how to get an OpenAI API key and run your first API request: account, billing, key, a curl example, and how to read rate limits. Trust Billing / Limits in your account over third-party quota tables.
Platform vs ChatGPT
platform.openai.com
Developer console: Billing, API keys, Usage, Limits. REST calls go to api.openai.com.
chatgpt.com
Consumer ChatGPT web/app. Plus subscription is not API quota; API bills separately by usage.
| Step | Official location | Common snag |
|---|---|---|
| Sign up / log in | platform.openai.com | Valid email; some regions may be restricted per signup page |
| Set up Billing | Settings → Billing | Without payment method, API calls may fail or stay very limited |
| Create API key | Settings → API keys → Create | Secret shown once; revoke and rotate if lost |
| First request | POST /v1/chat/completions | 401 → Authorization header; 429 → rate limits |
Sign up through first curl
- 01Sign up at platform.openai.com
Open platform.openai.com, register with email or supported OAuth, verify email, and land in the Dashboard. Quickstart lists Sign up / Log in as step one.
- 02Set up Billing
Go to Settings → Billing and add a supported card or payment method. API usage is metered by tokens; see Pricing. Calls may fail until Billing is ready.
- 03Create an API key
Settings → API keys → Create new secret key. Store it in a password manager. Authentication docs treat keys like passwords—never commit to Git or ship in frontend bundles. Create separate keys per project and revoke individually.
- 04Send your first Chat Completions curl
Export
$OPENAI_API_KEY, then POST tohttps://api.openai.com/v1/chat/completions. On success,choices[0].message.contentholds the model reply. - 05Read rate limits and 429
The Rate limits guide explains RPM and TPM caps per model. Response headers include
x-ratelimit-remaining-requests. On 429, honorretry-afteror lower concurrency; long-term caps live under Settings → Limits.
export OPENAI_API_KEY="sk-..." # never commit
curl https://api.openai.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{
"model": "gpt-4o-mini",
"messages": [{"role": "user", "content": "Say hello in one word."}]
}'
Where first calls usually break
- 401 Unauthorized
- Missing, mistyped, or revoked key. Confirm
Authorization: Bearerand Active status under Settings → API keys. - 429 Too Many Requests
- Hit RPM/TPM caps. Read headers and retry-after; Rate limits docs recommend exponential backoff.
- 403 or model not found
- Your usage tier may not include that model. Pick a default from Quickstart or check Limits.
Run one minimal curl before wiring Cline, Cursor, or your own service. A leaked key costs more than picking the wrong model—rotate instead of chasing invoices.
When the integration needs alignment
OpenAI API is HTTP; Copilot or Cursor Agent is a different path. Put endpoint, model, and rate-limit screenshots on one page. A short oakmeet room works—browser, space code, no account. Limits: eight people, about an hour. Compare Google AI Studio and Cline with your own key.
Does ChatGPT Plus include API quota?
No. Plus is a chatgpt.com subscription; API bills separately on platform.openai.com. See official Pricing and Billing docs.
Is there still a free API tier?
Policies and credits change. Trust Billing and Limits after signup—not outdated “$5 free credit” screenshots.
What if the key leaked?
Revoke it immediately under Settings → API keys and create a new one. Authentication docs say rotate regularly and never commit keys.
Can I raise rate limits?
The Rate limits guide ties caps to usage tiers. Check Settings → Limits for your tier and any upgrade path the page offers.