HomeAPIs › OpenAI

OpenAI API — pricing, free tier & how to get a key

OpenAI's API powers GPT-4o, GPT-4o mini and the o-series reasoning models — the most widely used large-language-model API in production. Here's what it costs, what you get for free, and exactly how to get your key.

OpenAI API pricing (reference, June 2026)

ModelInput $/1MOutput $/1MBest for
GPT-4o$2.50$10.00Quality generation, vision
GPT-4o mini cheapest$0.15$0.60Most tasks, high volume
GPT-4.1$2.00$8.00Long context, coding
GPT-4.1 mini$0.40$1.60Balanced cost/quality
o3$10.00$40.00Hard reasoning
⚠️ Reference prices, June 2026 — OpenAI updates pricing regularly. Confirm on openai.com/api/pricing before budgeting. Prices are per 1M tokens; output is billed separately and costs more.

Is there a free tier?

OpenAI has no permanent free tier for the API. New accounts occasionally get a small amount of trial credit that expires, but ongoing usage is pay-as-you-go. The good news: the cheapest model, GPT-4o mini, is so inexpensive that light projects often cost a few cents per day. Want a real free tier instead? See Google Gemini, which offers a generous free quota on AI Studio.

How to get an OpenAI API key (step by step)

1. Go to platform.openai.com and create an account (or sign in).
2. Open Settings → Billing and add a payment method. The API won't work without billing set up.
3. Go to the API keys page (platform.openai.com/api-keys).
4. Click Create new secret key, give it a name, and copy it — you can only see it once.
5. Set a monthly usage limit under Billing → Limits so a runaway script can't surprise you.

Test it with a simple request:

# quick test (replace $OPENAI_API_KEY)
curl https://api.openai.com/v1/chat/completions \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"hi"}]}'

Estimate your cost

Use the AI API Cost Calculator to plug in your token counts and request volume — it shows your monthly cost and ranks every model (including Claude and Gemini) from cheapest to most expensive for your workload.

Cheaper alternatives

If GPT-4o is more than you need: drop to GPT-4o mini (≈15× cheaper) for most tasks; or compare Claude Haiku and Gemini Flash, which target the same low-cost, high-volume niche. For the absolute cheapest, DeepSeek-V3 undercuts most US providers.

FAQ

Is the OpenAI API free?

No permanent free tier. New accounts may get small trial credits that expire; ongoing use is pay-as-you-go. GPT-4o mini is the cheapest model at ~$0.15/1M input tokens.

How do I get an OpenAI API key?

Create an account at platform.openai.com, add billing, open the API keys page, click Create new secret key, copy it once, and set a monthly usage limit.

Which OpenAI model is cheapest?

GPT-4o mini — roughly 15–20× cheaper than GPT-4o and good enough for most classification, extraction and simple generation tasks.

Why is output more expensive than input?

Generating tokens is more compute-intensive than reading them, so output is billed at 3–5× the input rate across providers.

Not affiliated with OpenAI. Prices are reference estimates — always verify on the official pricing page.