How to Get an OpenAI API Key
How do I get an OpenAI API key?
Sign in to OpenAI's console, create a new API key, and copy it immediately — it is shown only once. No payment method is required to generate the key itself. Set it as OPENAI_API_KEY in your environment; full steps below.
Verified 2026-08-09 — source
Steps
- Sign in at platform.openai.com and open Settings → API keys.
- Click "Create new secret key", name it, and optionally scope it to a project.
- Copy the key immediately — OpenAI shows the full value exactly once.
- Add a payment method under Settings → Billing before your first real call; the free tier is sandboxed to low limits.
- Set it as OPENAI_API_KEY in your environment, never committed to source control.
Key facts
| Env var | OPENAI_API_KEY |
| Payment required before first call | No |
| Scoped to project/org | Yes |
| Shown once | Yes |
FAQ
Do I need a credit card to get an OpenAI API key?
No — you can generate the key without a payment method, though usage limits stay low until you add one.
Can I see my OpenAI API key again after closing the page?
No — OpenAI shows the full key value exactly once. If you lose it, revoke it and create a new one.
Is this the same as an All AI Ask API key?
No. This page is about creating an API key with OpenAI directly, for calling their API yourself. For an All AI Ask key — one key that routes to OpenAI and every other provider we support — see /api-keys.
