Get a key from OpenAI, step by step
- Sign in to the OpenAI Platform at platform.openai.com, OpenAI's site for developers. A ChatGPT subscription doesn't carry over to it.
- Open the API keys page of a project: Settings → API keys. Each project has its own keys, so a key made in one project only reaches that project.
- Click Create new secret key. Name it, choose whether it belongs to you or to a service account (better for servers and CI), and pick its permissions: All, the default, Restricted to the scopes you choose, or Read only.
- Copy it now. OpenAI shows the full key only when you create it. Store it in a password manager or your secrets manager; if it's lost, create another.
- Add credit. New API accounts are prepaid: on the Billing page, buy credit from $5 (the default is $10). Auto-reload is on by default during setup, purchased credit expires after a year, and it isn't refundable.
Test the key
The OpenAI SDKs read the key from OPENAI_API_KEY. One request to the Responses API:
export OPENAI_API_KEY="your-key"curl https://api.openai.com/v1/responses \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -H "Content-Type: application/json" \ -d '{"model": "gpt-6-astra", "input": "Say hello"}'On Windows, set the variable with setx OPENAI_API_KEY "your-key" and open a new terminal.
What an OpenAI API key costs
The key is free; every request is billed per token. List prices per 1M tokens:
| Model | Input | Output | On Zurelay (in / out) |
|---|---|---|---|
| GPT-6 Astra | $10.00 | $50.00 | $2.50 / $12.50 |
| GPT-6.1 Sol | $2.00 | $10.00 | $0.50 / $2.50 |
| GPT-6.1 Terra | $1.00 | $5.00 | $0.25 / $1.25 |
| GPT-6 Luna | $0.10 | $0.50 | $0.025 / $0.125 |
How much you can spend depends on your usage tier, set by what you've paid in total:
| Tier | To qualify | Usage limit a month |
|---|---|---|
| Free | Live in a supported country | $100 |
| Build | $5 of credit bought | $500 |
| Launch | $100 bought | $5,000 |
| Grow | $500 bought | $200,000 |
These tiers replaced Tiers 1 to 5 in 2026. Rate limits per model rise with each tier.
Does ChatGPT Plus include API access?
No. OpenAI bills API usage separately from ChatGPT, so Plus and Pro include no API credit and no key.
Codex, OpenAI's coding agent, works either way: sign in with ChatGPT to use your plan, or with an API key to pay per token. Codex cloud needs the ChatGPT sign-in.
Is there a free OpenAI API key?
Accounts start on the Free tier, and OpenAI's quickstart calls the first request a free test request, but real use needs credit. Skip sites that hand out shared keys: they get revoked, and anyone else on the key sees its traffic.
Keep the key safe
- Keep it on the server. A key in front-end code, a mobile app or a public repository is visible to anyone.
- Give each app its own project and key, with Restricted permissions where it only needs a few endpoints.
- Use a service account key for servers rather than a person's own key.
- If a key leaks, delete it on the API keys page and create a new one.
Another way: one key for GPT, Claude and the rest
A Zurelay key works with the OpenAI SDKs through Chat Completions and costs less per token (75% below OpenAI's list on GPT-6.1 Terra). Credit starts at $10, and the same key reaches Claude, Gemini and DeepSeek. Change the base URL and the key:
from openai import OpenAIclient = OpenAI( base_url="https://api.zurelay.com/v1", api_key="YOUR_ZURELAY_KEY",)reply = client.chat.completions.create( model="gpt-6.1-terra", messages=[{"role": "user", "content": "Say hello"}],)print(reply.choices[0].message.content)Zurelay serves Chat Completions, not the Responses, Realtime, embeddings, fine-tuning or Batch APIs; if you build on those, keep an OpenAI key. The OpenAI API alternative page compares the two.
Steps, billing and tiers read from OpenAI's prepaid billing, projects, rate limits and ChatGPT and API billing pages on October 28, 2026.