OpenAI API Explained: GPT, Whisper, Embeddings and Images — Which API for Which Job

Human Verified 0

Share to: , and

A wide, calm illustration of a developer's map: many small glowing paths from one central hub leading to different destinations, suggesting one API with many jobs

OpenAI API Explained: GPT, Whisper, Embeddings and Images — Which API for Which Job

A wide, calm illustration of a developer's map: many small glowing paths from one central hub leading to different destinations, suggesting one API with many jobs

The OpenAI API in one paragraph: The OpenAI API is the paid, developer-facing way to use OpenAI’s models inside your own software, and it is a different thing from the ChatGPT app. You send a request to an endpoint, OpenAI’s model does the work, and you pay for what you use, mostly by the token. The right API depends on the job: the Responses API for text, chat, and agents; Whisper and the transcription models for turning speech into text; embeddings for search and retrieval; the image models for generating and editing pictures; and the Realtime API for live voice conversations. Pick the job first, then the API, then the model — in that order — and most of the confusion disappears.

The OpenAI API is best understood as a set of specialist counters inside one building. You walk in with a key, you choose the counter for your job, and you pay for what that counter does. Text goes to the language models. Audio goes to the speech models. Pictures go to the image models. Search goes to embeddings. And when you want the model to do several of those things in one flowing task, you give it tools and let it run a loop. This guide walks every counter in turn, in plain language, with the prices OpenAI lists and the limits it publishes, so you can choose without guessing.

Checked 6 November 2026. Model names and prices on this page are the ones listed on OpenAI’s own pricing and documentation pages on that date, and they change often — GPT-Image-1, for example, was shut down on 23 October 2026, and new model families have appeared since GPT-5. Before you spend money, re-check the price of the exact model ID you plan to call on OpenAI’s pricing page, and confirm the model is still available in your account. Where this article could not verify a figure on an OpenAI page in this session, it says so rather than repeating a number as fact.

1. The Short Answer: Which API for Which Job

<img src="

A simple road-sign crossroads at dawn, with several blank signposts pointing in different directions, suggesting choosing the right tool for each job

” alt=”A simple road-sign crossroads at dawn, with several blank signposts pointing in different directions, suggesting choosing the right tool for each job” />

If you only read one section, read this one. The OpenAI API is not one API but a family of them, and the most common beginner mistake is using the text API for a job that has a cheaper, better specialist. Here is the map in brief, with the detail in the sections that follow.

For writing, answering, summarising, translating, coding help, and anything that starts with words and ends with words, use the Responses API with a GPT model. It is the API OpenAI now recommends for all new projects, and it is the one this guide uses for its examples. If you already have working code on the older Chat Completions API, that API is still supported, so there is no emergency — but new work should start on Responses.

For turning recorded speech into text — meeting notes, interviews, podcasts, voicemail — use the transcription models. Whisper is the famous name here, but the current workhorses are gpt-transcribe for files and gpt-live-transcribe for live audio, and both are priced by the minute of audio, not by the token. For turning text into spoken audio, use the speech generation models, which return audio you can play back.

For search inside your own documents — “find the paragraph in our manuals that answers this question” — use embeddings. An embedding turns a chunk of text into a list of numbers that captures its meaning, and you compare those numbers to find the closest matches. This is the foundation of retrieval-augmented generation, usually shortened to RAG, and it is covered in section 6.

For generating or editing images from a text description, use the image models through the Responses API’s image generation tool or the images endpoints. The current models are the GPT-Image-2.5 and 2.6 families, sold under the Sunburst and Flare names. Do not build on gpt-image-1: OpenAI shut it down on 23 October 2026, and its page now points developers to GPT-Image-2.5 Sunburst instead.

For a live voice conversation — a phone-style assistant that listens, thinks, and answers out loud with barely a pause — use the Realtime API, currently built around gpt-realtime-2.1 and its smaller sibling. For an assistant that does multi-step work on its own, calling your functions, searching files, and handing off between specialists, use the Agents SDK on top of the Responses API. And for anything where the model needs to look something up on the live web, use the built-in web search tool rather than bolting on a search engine yourself.

2. How the OpenAI API Actually Works: Keys, Playground, and Projects

A tidy desk with a key, a notebook, and a laptop showing a plain glowing screen, suggesting setting up access to a developer platform

At its simplest, the API is a web address you send requests to. Your program sends a message — usually in a format called JSON — to an endpoint such as /v1/responses, and OpenAI sends back a structured reply. The official software libraries for Python and JavaScript wrap that exchange so you write a few lines of code instead of raw web requests, but underneath, it is still one request and one reply at a time.

Access is controlled by an API key, a long secret string that identifies your account and authorises spending. You create keys in the developer dashboard, under the API keys section, and you can create more than one — for example, one per project or per environment — and revoke any of them at any moment. Treat a key like a password, because that is what it is: anyone holding it can spend your money. Never put a key in code you share, never paste it into a public forum, and never ship it inside a mobile app or a web page, where anyone can read it. Server-side only, stored in an environment variable or a secrets manager, is the rule that keeps you safe. If a key ever leaks, revoke it and make a new one; there is no way to un-leak a secret.

OpenAI organises accounts into organisations and projects. An organisation is the billing account; a project is a workspace inside it, with its own keys and its own limits. That matters when you run into rate limits, because the limits apply at the organisation and project level, not per key or per user — two apps sharing a project share one pool, and one app hammering the API can slow the other. For anything beyond a hobby experiment, give each app its own project.

Before you write code, try the Playground. It is a page in the developer dashboard where you can type a prompt, pick a model, adjust settings like temperature and reasoning effort, and see the reply and the token count — all without writing a line of code. It is the fastest way to learn what a model can and cannot do, and the fastest way to estimate cost, because it shows you how many tokens a request actually used. Prototype in the Playground, then move the prompt that works into code.

Billing works on prepaid credits: you add funds, and every call draws down the balance. The rate-limits guide lists a Free usage tier with a $100 monthly usage limit for users in an allowed geography, but whether a new account receives free starting credits was not verified in this session — check your own billing dashboard. The ladder is certain: $5 in total credit purchases moves your organisation to Build, $100 to Launch, $500 to Grow, with higher rate limits and monthly ceilings at each step, upgraded automatically. If you only know ChatGPT, start with our guide to using ChatGPT to get a feel for what the models do, then come back here when you want to put one inside your own software.

3. Responses API vs Chat Completions: The Choice That Shapes Your App

Two parallel bridges crossing the same river toward the same far bank, one newer and wider, suggesting two APIs that reach the same place differently

The two text APIs are the first real decision a new developer faces, and OpenAI’s own documentation now settles it plainly. The Responses API is, in its words, “our new API primitive, an evolution of Chat Completions”, and “while Chat Completions remains supported, Responses is recommended for all new projects.” That is the whole decision in one sentence if you are starting fresh. The rest of this section explains what changes if you choose one or the other, and why existing Chat Completions code does not need to be rewritten in a panic.

Chat Completions is the older style, launched with GPT-3.5 Turbo in March 2023. You send a list of messages, each with a role — system, user, or assistant — and you get back a reply tucked inside a “choices” array, which you read as completion.choices[0].message.content. You manage the conversation yourself: every turn, you resend the whole message history, because the API remembers nothing between calls. It is simple, well understood, and supported by nearly every tool, library, and tutorial written in the last three years. It can also return several candidate replies at once using the “n” parameter, which Responses cannot do.

The Responses API, launched in March 2025, keeps the easy single-call feel of Chat Completions and adds the tooling that used to belong to the older Assistants API, which OpenAI has since retired. You send instructions and an input — a plain string or a list of typed items — and you read the answer from response.output_text. The differences that matter are these. First, built-in tools: web search, file search, computer use, code interpreter, and remote MCP servers are available inside a Responses call, so the model can search the web or your files without you writing those integrations. Second, an agentic loop by default: the model can call several tools, including your own functions, within a single request, instead of you writing the loop yourself. Third, state: responses are stored by default, so a later call can continue a conversation by passing previous_response_id, or you can use the Conversations API for a persistent conversation object — no more resending the whole transcript every turn, although you still pay for the earlier tokens as input when the chain is replayed. Fourth, reasoning models behave better: OpenAI’s own internal evaluations report roughly a 3% improvement on the SWE-bench coding benchmark when reasoning models like GPT-5 run through Responses rather than Chat Completions, and 40% to 80% better cache utilisation in its internal tests. Those are OpenAI’s own test figures, not independent verification, but they explain why the company is steering new work this way.

Smaller differences: in Responses, structured outputs use text.format instead of response_format, function definitions drop the outer “function” wrapper, and omitting “strict” attempts strict mode — set strict: false explicitly for the old lenient behaviour. Either API can turn storage off with store: false, and OpenAI offers encrypted reasoning items for zero-data-retention organisations. From GPT-5.4 onward, Chat Completions does not support tool calling with reasoning_effort values other than none.

4. GPT Models in the API: GPT-5, GPT-5.1, and the GPT-6 Family

A family of nested wooden figures on a shelf, from tiny to large, suggesting a family of models in different sizes

The text models are the heart of the API, and the lineup has grown fast. The GPT-5 family is the workhorse range most developers will actually use, and the GPT-6 family is the newer flagship range at the top of the price list. The names matter less than the pattern: each family comes in sizes, from a tiny cheap model for high-volume simple work up to a large flagship for the hardest reasoning, and the right choice is usually the smallest model that does the job well.

Start with the GPT-5 family. The standard model, gpt-5, costs $1.25 per million input tokens and $10 per million output tokens, with cached input at $0.125 — the prices OpenAI lists on its pricing page as read on 6 November 2026. Its context window totals 400,000 tokens, split in the GPT-5 generation into up to 272,000 input tokens and 128,000 output tokens, which is the number that matters when you plan long documents: the model can see a lot, but the reply it writes back is capped well below the total. The gpt-5.1 update costs the same $1.25 and $10, and gpt-5.4 costs $1.25 in and $7.50 out, while gpt-5.5 costs $2.50 in and $15 out for requests under 272,000 tokens of context. The point releases are real models with real differences in behaviour, not just new labels, but for most apps the choice between 5, 5.1, and 5.4 is a matter of testing your own prompts rather than reading a leaderboard.

The smaller GPT-5 sizes are where the money is saved. GPT-5 mini, at $0.25 per million input tokens and $2 per million output tokens, costs a fifth of the full model and handles the bulk of everyday work — classification, summarising, drafting, simple question-answering — with quality that surprises people who assume bigger is always better. GPT-5 nano, at $0.05 in and $0.40 out, is cheaper still, built for high-volume, low-complexity tasks like tagging, routing, and short extractions. At the other end, GPT-5 Pro costs $15 in and $120 out and exists for the hardest work where accuracy matters more than the bill. A sensible default is to prototype on the full model, then test whether mini does the same job on your real inputs; if it does, you have just cut your text bill by 80%.

Above the GPT-5 family sits the GPT-6 family, the current flagship range. GPT-6 Astra is the top model at $10 per million input tokens and $50 per million output tokens, with cached input at $1. GPT-6.1 Sol costs $2 in and $10 out, GPT-6.1 Terra $1 in and $5 out, and GPT-6 Luna, the small fast member, $0.10 in and $0.50 out. Specialists include GPT-5.6 Sol at $4 in and $20 out, with promotional pricing available until 30 November 2026, and GPT-5.3 Codex at $1.75 in and $14 out, the coding model behind OpenAI’s Codex tools. Prices rise for long-context requests above 272,000 tokens, and regional data-residency endpoints add a 10% uplift for models released on or after 5 March 2026.

Older models are still listed and still work. GPT-4o costs $2.50 in and $10 out on the Standard tier, GPT-4o mini $0.15 in and $0.60 out, and GPT-4.1 $2 in and $8 out. There is rarely a reason to choose them for a new project unless you need a specific behaviour you have already tested, or you are keeping an old system stable. And a word on the o-series reasoning models, o3 and o3-pro, which still appear on the pricing page: they were the previous generation’s reasoning specialists, and GPT-5’s reasoning capability has largely taken over their role. For the history behind these model generations, from GPT-3 to GPT-5, see our OpenAI explainer, and for how a GPT model actually works, in plain language, see our guide to how AI works. If you are torn between model sizes, our guide to choosing an AI model walks through the same trade-off — capability against cost against speed — from the user’s side.

5. Whisper and Speech: Turning Audio Into Text, and Text Into Speech

Sound waves flowing from a microphone into a stream of written words on paper, suggesting speech turned into text

Speech is the API family most people underestimate, because the text models get the headlines. In practice, transcription is one of the cheapest and most reliable things you can buy from OpenAI, and it unlocks a whole class of apps — meeting notes, call summaries, subtitling, voice search — that would have needed a specialist vendor a few years ago.

Whisper is the name everyone knows: an open speech-recognition model trained on a huge amount of multilingual audio, able to transcribe speech in many languages and translate it into English. In the API, though, the model you will actually call today is usually not whisper-1 itself. OpenAI’s current transcription lineup is gpt-transcribe, which handles audio files at $0.0045 per minute, and gpt-live-transcribe, which streams live audio at $0.017 per minute. There is also gpt-realtime-whisper, a streaming speech-to-text model for live transcription at the same $0.017 per minute, and the older gpt-4o-transcribe family, listed at $0.006 per minute for the full model and $0.003 for the mini. Whisper-1 was long listed at $0.006 per minute, but it no longer appears on the pricing page extract read for this article, and secondary sources report that OpenAI plans to retire whisper-1 and the gpt-4o transcribe models on 26 February 2027 in favour of gpt-transcribe and gpt-live-transcribe — a date this article could not verify on an OpenAI page in this session, so check OpenAI’s deprecations page before building anything long-lived on whisper-1.

The practical difference between the transcription models is about timing, not just price. File transcription is for audio you already have: you upload a recording and get the whole transcript back. Live transcription is for audio happening now: you stream it in and get transcript pieces back as the speaker talks, with low enough delay for captions and live assistants. If your app records a call and summarises it afterwards, file transcription is the right tool and the cheapest. If your app needs to react while someone is still speaking, you need the live models, and you should budget for them accordingly — $0.017 a minute is about a dollar an hour, which is cheap until a thousand users are talking at once.

One feature decides which transcription model to pick more often than price does: timestamps. Word-level and segment-level timestamps tell you when each word was spoken, which you need for subtitles, for jumping to a moment in a recording, and for diarisation — telling speakers apart. The older whisper-1 was long the go-to model when timestamps mattered, because some newer models do not provide word timestamps, so check the model page for the exact model you choose before building a feature that depends on them.

For a dedicated voice alternative, our ElevenLabs explainer covers the best-known voice specialist.

6. Embeddings and Retrieval: Teaching Your App to Find Things (RAG)

A vast library where books float toward a reader along glowing threads, suggesting search and retrieval finding the right passage

Embeddings are the quiet workhorse of the OpenAI API, and the one most beginners skip — which is a shame, because they are also the cheapest and the most useful. An embedding is a list of numbers, called a vector, that represents the meaning of a piece of text. Two pieces of text with similar meanings get vectors that sit close together; two unrelated pieces sit far apart. That single trick is what makes search inside your own documents possible.

The workflow, called retrieval-augmented generation or RAG, has four steps: split your documents into chunks of a paragraph or two; send each chunk to the embeddings endpoint to get its vector; store the vectors in a vector store; and when a user asks a question, embed the question, find the closest chunks, and hand them to a GPT model with the question. The model then answers from your documents instead of its training data — your products, your policies, your private knowledge.

OpenAI’s current embedding models are text-embedding-3-small and text-embedding-3-large, and the choice between them is refreshingly simple. The small model costs $0.02 per million tokens and produces vectors 1,536 numbers long by default; the large model costs $0.13 per million tokens and produces vectors 3,072 numbers long. Both accept up to 8,192 tokens of input, and both let you shorten the vector if you want to save storage. OpenAI’s help pages put the difference in plain terms: at the small model’s price, roughly 62,500 pages of text cost a dollar to embed, against about 9,615 pages for the large model, while the large model scores a little higher on the standard multilingual retrieval benchmark. For most apps, the small model is the right default, and the large model is for cases where retrieval quality is the product — legal search, medical documents, anything where a missed passage costs real money.

7. Images: GPT-Image Models and the End of GPT-Image-1

An artist's easel in a bright studio where a blank canvas slowly fills with a landscape, suggesting an image being generated from a description

Image generation through the OpenAI API is powerful, fast-moving, and currently in the middle of a changing of the guard — which is why this section starts with a warning rather than a feature list. GPT-Image-1, the model that powered image generation in the API for much of 2025, was shut down on 23 October 2026 and is no longer available. Its model page now says so plainly and recommends GPT-Image-2.5 Sunburst for current image generation and editing. If you are following a tutorial or copying code that names gpt-image-1, it will not work, and the fix is to move to the 2.5 or 2.6 models.

The current lineup is the GPT-Image-2.5 and 2.6 families, each sold in two variants, Sunburst and Flare. On OpenAI’s pricing page, all four are listed at the same rates: image tokens at $8 per million input tokens and $30 per million output tokens, with cached input at $2, and text tokens at $5 per million input, cached at $1.25. What that means in practice is that image cost depends on the size and quality you ask for, because a bigger or more detailed image uses more tokens. OpenAI’s documentation includes a calculator for estimating image generation costs, and you should use it before promising a customer a price per image, because the per-image cost varies with your settings rather than being a single flat number.

Editing is where the image API earns its keep for real products. You can send an existing image with a text instruction — change the background, remove an object, restyle a scene — and get back a modified image. The model is genuinely good at following editing instructions, and it is also genuinely imperfect: text inside generated images can come out garbled, faces and hands can go wrong, and fine detail can shift in ways you did not ask for. For production use, treat the first generation as a draft, keep the prompt specific about what must not change, and build a human review step into any workflow where the image will be seen by customers.

Image generation is slow compared with text, so build a loading state or background job rather than holding a web request open — and remember generated images are the model’s best guess at your words, not photographs, so use a real image where accuracy matters. If your project needs moving pictures, our comparison of AI video generators covers the tools for that job.

8. Realtime API: Talking to Your App Out Loud

Two people talking across a table with sound waves flowing between them in real time, suggesting a live voice conversation with an app

The Realtime API is the closest the OpenAI platform comes to a phone call. Instead of sending a recording and waiting for a transcript, or sending text and waiting for audio, you open a live session — over a technology called WebRTC, the same one video calls use — and the model listens and speaks in a continuous flow, interrupting and being interrupted much like a person. It is the API behind voice assistants, phone agents, and any app where typing would be too slow.

The current models are gpt-realtime-2.1 and its smaller sibling gpt-realtime-2.1-mini, and the pricing shows why the mini matters. The flagship charges $32 per million audio input tokens and $64 per million audio output tokens, with cached input at $0.40, and text at $4 in and $24 out. The mini charges $10 and $20 for audio, with cached input at $0.30, and text at $0.60 in and $2.40 out. Audio is where the money goes: the model’s own speech is the expensive part, and a minute of the assistant talking costs far more than a minute of the user talking. Secondary analyses of real sessions put a typical voice conversation at roughly $0.06 to $0.11 per minute on the flagship once caching is working, and $0.02 to $0.05 on the mini — useful as a rough guide, but your own numbers will depend on how much your assistant talks, how long your instructions are, and how well caching works for you.

Building on the Realtime API is harder than building on the text APIs: you must handle audio streaming, interruptions, turn-taking, and network stutters, because a voice call that drops is a failed call in a way a slow text reply is not. Set session limits and silence timeouts from the start — a session left open with nobody speaking still costs money if the model keeps generating audio.

When is it worth it? When the user cannot or will not type: driving, cooking, working with their hands, or calling on a phone. When the conversation is short and the answer is spoken: a booking, a status check, a quick question. When the experience of talking matters more than the transcript. When the job is a long written document, a careful analysis, or anything the user needs to read and re-read, the text APIs are better, cheaper, and easier to get right.

9. Agents SDK, Function Calling, and Built-In Tools

A small team of helpers passing tools to each other around a workbench, suggesting agents handing work between specialists

Function calling is the feature that turns a language model from a clever autocomplete into something that can do work. You describe a function — its name, what it does, and what inputs it takes — in a structured format, and the model decides when to call it. Your code runs the function, sends the result back, and the model uses it to continue. The classic example is weather: the model cannot know today’s weather, but it can call your get_weather function with a location, read the result, and answer. The same pattern powers booking systems, database lookups, calculators, and anything else where the answer lives outside the model.

The Responses API runs this as an agentic loop by default: inside a single request, the model can call several tools in turn, including your own functions and OpenAI’s built-in tools, until the task is done. The built-in tools are web search, file search, computer use, code interpreter, and remote MCP servers. Web search costs $10 per 1,000 calls, plus the search content tokens at model rates — the tokens pulled from the search results and fed to the model — and it is the tool to reach for when the answer depends on something that happened after the model’s training. File search, at $2.50 per 1,000 calls plus storage, searches your own uploaded documents. Code interpreter runs code in a hosted container, billed by container size and time, and is the right tool when the task involves calculation, data analysis, or generating a file. Computer use lets a model operate a computer interface, clicking and typing, and it is powerful and slow and best reserved for tasks where there is genuinely no API to call instead.

The Agents SDK is the orchestration layer that sits on top of all this, and it is the piece most developers reach for when a single tool call is not enough. It is an open-source library — install it with pip install openai-agents in Python, with a TypeScript version also available — and OpenAI describes it as a production-ready upgrade of its earlier experimental Swarm framework. Its primitives are deliberately few: an Agent is a model plus instructions plus tools; a Handoff lets one agent pass the conversation to a specialist agent; Guardrails are checks on inputs and outputs that can stop a run early; and Tracing records every step for debugging. In combination, those few pieces are enough to build a support system where a triage agent routes billing questions to a billing agent and technical questions to a technical agent, with a guardrail that blocks requests containing sensitive personal data before they reach any tool.

Handoffs deserve a closer look, because they are the idea that makes multi-agent systems manageable. In a handoff, the first agent gives the whole conversation to a second agent, which takes over with its own instructions and tools — the customer never sees the switch. That is different from calling an agent as a tool, where the first agent stays in charge and just borrows the second agent’s output. Use handoffs when a specialist should own the rest of the conversation; use agents-as-tools when an orchestrator should collect answers from several specialists and combine them. Guardrails, meanwhile, run alongside the agent loop rather than as a gate in front of it: input guardrails fire for the first agent, output guardrails for the agent that produces the final answer, and tool guardrails on function calls — and they can trip an exception mid-run, which is the behaviour you want when a check fails, because a half-finished agent action is worse than a stopped one.

For the coding side of this world, our GitHub Copilot explainer shows how the same ideas appear inside a programming tool, and our GEO explainer covers what happens when AI answers, rather than links, become the way people find things — the reason the web search tool matters as much as it does.

10. Pricing, Explained Honestly: Per-Token Math and Worked Examples

A market stall with a scale weighing small coins against a stack of paper slips, suggesting paying per token

OpenAI’s API pricing looks complicated until you understand the one idea underneath it: you pay for tokens, and a token is a piece of a word. A token is roughly three-quarters of a word in English, so 1,000 tokens are about 750 words, and a typical short chat reply might use a few hundred tokens while a long document can use tens of thousands. Every price on OpenAI’s pricing page is quoted per million tokens, split into input tokens — everything you send, including your instructions, your conversation history, and any tool results — and output tokens — everything the model writes back, including reasoning tokens on reasoning models. Output tokens cost several times more than input tokens, which is why a long reply is the expensive part of most calls.

Here is the arithmetic, using the Standard prices OpenAI lists as read on 6 November 2026. A single GPT-5 request with 1,000 input tokens and 500 output tokens costs 1,000 divided by a million times $1.25, plus 500 divided by a million times $10 — that is $0.00125 plus $0.005, or about $0.006 in total, a little over half a cent. The same request on GPT-5 mini costs about $0.00125, and on GPT-5 nano about $0.00025. Now scale it: a small app handling 10,000 such requests a month on GPT-5 pays roughly $62.50, on mini roughly $12.50, and on nano roughly $2.50. That is the whole budgeting method in one paragraph, and it is why the model choice matters more than any optimisation trick: the gap between nano and the full model is a factor of twenty-five.

Three discounts change the picture. Prompt caching is the biggest: repeated instructions or document context are charged at a tenth of the normal input rate — $0.125 per million for GPT-5 instead of $1.25 — and the Responses API is designed to make caching work well. The Batch API is the second: requests that can wait up to a day cost half price, GPT-5 at $0.625 in and $5 out. The third is the simplest: use the smallest model that does the job.

Tools and extras are billed on top of tokens, and they are where bills surprise people. Web search costs $10 per 1,000 calls, plus the search content tokens fed to the model. File search costs $2.50 per 1,000 calls plus $0.10 per gigabyte of storage per day, with the first gigabyte free. A code interpreter session costs $0.03 for a 1-gigabyte container up to $1.92 for a 64-gigabyte one per twenty-minute session. Image tokens are billed per million, and transcription and live voice are billed per minute of audio or per token as set out in the sections above. None of these is expensive on its own, but an agent that searches the web on every turn, or a voice app that keeps a session open all day, can quietly spend more on tools than on the model itself. Log the tool calls, not just the tokens.

11. Rate Limits, Quotas, and Errors: What Happens When You Hit the Wall

A calm traffic light at a quiet junction with a few cars waiting patiently, suggesting rate limits and queues

Rate limits are the API’s way of saying “not that fast”. They cap how many requests and how many tokens you can send in a minute or a day, and they exist to keep the service fair and stable for everyone. When you exceed one, the API answers with an error — usually HTTP 429, “too many requests” — and your code has to decide what to do next. The right answer is almost always to wait a little and try again, with a pause that grows longer each time. This is called exponential backoff, and it is the single most important piece of error handling in any API app. The wrong answer is to retry immediately in a tight loop, which turns a brief slowdown into a flood that keeps you limited for longer.

OpenAI measures limits in several ways at once: RPM, requests per minute; RPD, requests per day; TPM, tokens per minute; TPD, tokens per day; IPM, images per minute; and audio minutes per minute for some streaming audio models. Which one bites first depends on what your app does. An app sending many tiny requests will hit RPM first. An app sending a few enormous documents will hit TPM first. An image app will hit IPM. And the limits apply at the organisation and project level, not per key and not per user, so one misbehaving app in a project can use up the allowance for everything else in that project — another reason to give each app its own project.

Your limits grow as you spend. The rate-limits guide lists four tiers: Free, with a $100 monthly usage limit for users in an allowed geography; Build, reached at $5 in total credit purchases, with a $500 monthly usage limit; Launch, at $100 in purchases, with a $5,000 limit; and Grow, at $500 in purchases, with a $200,000 limit. The tiers upgraded from five paid levels to three on 6 October 2026, so older guides that talk about Tier 1 to Tier 5 are out of date. As an example of what the tiers mean in practice, the guide lists Standard limits for the GPT-6 Astra, Sol, and Terra models at 5,000 requests per minute and 1,000,000 tokens per minute on Build, rising to 10,000 and 4,000,000 on Launch, and 15,000 and 40,000,000 on Grow — with Luna higher still, at 30,000 requests and 180,000,000 tokens per minute on Grow. Your organisation’s real limits for each model are shown in the dashboard under Settings, then Organization, then Limits, and that page is the authority for your account.

Other errors are worth knowing by name. A 401 means your key is wrong or revoked; a 400 means the request is malformed; a 404 on a model name usually means it is retired or mistyped — gpt-image-1 after its 23 October 2026 shutdown is a live example; a 500 or 503 means something failed on OpenAI’s side, so retry after a pause. Log the error code, the model, and the time for every failure, and you will be able to tell a billing problem from a code problem from an OpenAI problem in minutes instead of hours.

12. Security and Data Handling: Keys, Privacy, and What OpenAI Keeps

A locked safe with a key beside it on a wooden desk, with a soft light, suggesting keeping API keys and data secure

Security for the OpenAI API starts with one rule and mostly ends with it: keep your API key on your server, and never let it reach a user’s device. Every request your app makes is authorised by that key, and anyone who has it can spend your money and read your usage. Use environment variables or a secrets manager, never a file committed to a code repository, and rotate keys when a team member leaves or a laptop is lost. If you are building a product where the user’s browser or phone needs to talk to OpenAI directly, the safe pattern is to send the request to your own server first and let the server call OpenAI — a small extra step that keeps the key out of reach.

Beyond keys, the practical security list is short and worth following in full. Restrict each key to the project it belongs to, and give each environment — development, testing, production — its own key, so revoking one does not break the others. Set monthly spend limits and alerts before launch, not after the first surprise bill. Validate and limit what users can send through your app: a text box that forwards anything to the API is an invitation for someone to paste a hundred thousand tokens or to try to extract your system instructions, a trick known as prompt injection, where text in user input or in a document tries to override your instructions. The model will sometimes follow such instructions, so treat user input and retrieved documents as data, never as instructions, and never let a tool call act on a document’s say-so without a check.

What happens to the data you send? OpenAI’s stated position is that API data is not used to train its models by default, as published in its data-use documentation. But policies change: what OpenAI stores, for how long, and for what purpose are set out in its “Your data” guide and terms of use, so read the current version before sending anything sensitive, and check whether you need a zero-data-retention arrangement or an enterprise agreement. Responses are stored by default so conversations can continue; you can turn that off with store: false, and zero-data-retention organisations get store: false enforced automatically, with encrypted reasoning items keeping stateful reasoning working without stored state.

13. Your First App: From API Key to a Working Call

A first small wooden boat being launched from a shore into calm water, suggesting a first app setting out

The fastest way to learn the API is to make one real call, and the whole setup takes less time than reading this section. Start in the developer dashboard: create an account, add a payment method, buy a small amount of credit, and create an API key. Save the key somewhere safe immediately — you will not be shown it again in full — and put it in an environment variable, not in your code. Then try the Playground with a prompt of your own, watching the token count, before you write anything. The Playground is where you learn what the model does with your words; code is where you repeat it reliably.

Next, install the official library. In Python, that is pip install openai, and in JavaScript, npm install openai. The library reads your key from the environment, so your first program can be as short as creating a client and asking a question. Using the Responses API, the call looks like this: client.responses.create with a model of gpt-5-mini and an input of “Write a one-sentence bedtime story about a unicorn”, and the answer comes back in response.output_text. The same question through Chat Completions looks slightly different: client.chat.completions.create with the same model and a messages list containing a user message, and the answer comes back in completion.choices[0].message.content. Both patterns are taken from OpenAI’s own documentation, and the difference between them is the difference this guide described in section 3: a list of messages against a single input, and a choices array against a typed output.

From there, build outward in small steps, and test each one before adding the next. Add a second turn, and see how the conversation continues — with Responses, by passing previous_response_id, or by passing the earlier output items back in; with Chat Completions, by appending the reply to your messages list and resending it. Add a system instruction, and see how it steers the model’s tone and behaviour. Add a tool: define a simple function, let the model call it, and watch the loop run. Then add the parts that make a demo into a product — error handling with retries, a token counter that logs usage, a spending alert, and a timeout so a slow call cannot hang your app forever.

14. Frequently Asked Questions

An open question mark made of soft light standing in a quiet garden at dusk, suggesting frequently asked questions

Is the OpenAI API free? No, not as a service. The API is metered: you buy credits and pay per token, per minute of audio, or per image, depending on what you use. The rate-limits guide lists a Free usage tier with a $100 monthly usage limit for users in an allowed geography, but whether a new account receives free starting credits was not verified for this article — check your billing dashboard. A ChatGPT subscription does not include API credits.

What is the difference between the OpenAI API and ChatGPT? ChatGPT is an app you chat with, sold as a subscription. The API is a developer service that lets your own software call the same models and pay per use. They share models but not billing, not limits, and not features: the API gives you model choice, tools, and programmatic control that the app does not.

Should I use the Responses API or Chat Completions? For new projects, the Responses API — OpenAI recommends it for all new work, and it is the only route to the built-in tools and the agentic loop. Chat Completions remains supported, so existing code keeps working, but it does not get the new tools, and from GPT-5.4 onward it does not support tool calling with reasoning switched on.

Which GPT model should I start with? GPT-5 mini for most text work: at $0.25 per million input tokens and $2 per million output tokens, it is a fifth of the price of the full GPT-5 and good enough for the majority of tasks. Move up to GPT-5 when mini’s answers are not good enough on your real inputs, and down to GPT-5 nano for high-volume simple jobs. Test on your own data rather than trusting a leaderboard.

How much will the API cost me? It depends on the model and the volume, but the arithmetic is simple: a typical GPT-5 request of 1,000 input tokens and 500 output tokens costs about $0.006, and 10,000 such requests a month cost about $62.50. The same workload on GPT-5 mini costs about $12.50 a month. Use the smallest model that does the job, enable prompt caching, and use the Batch API for work that can wait a day.

Does OpenAI train on my API data? OpenAI’s stated policy is that API data is not used to train models by default. Read the current “Your data” guide and terms before sending sensitive information, and use store: false or a zero-data-retention arrangement if your use case needs it.

What happens if I hit a rate limit? The API returns an HTTP 429 error. Wait and retry, with a pause that grows each time, and check your usage tier — limits rise automatically as your total credit purchases reach the Build, Launch, and Grow thresholds. Your exact limits are in the dashboard under Settings, then Organization, then Limits.

Is GPT-Image-1 still available? No. OpenAI shut it down on 23 October 2026. Use GPT-Image-2.5 Sunburst or the 2.6 models instead, and update any tutorial code that still names gpt-image-1.

That is the map. The OpenAI API rewards the developer who starts with the job, picks the specialist API for it, chooses the smallest model that does it well, and watches the token meter while building. Start with one call in the Playground, then one call in code, then one small app with a real user — and let the bigger systems, the agents and the voice interfaces, grow out of something that already works.

Sources and further reading

  • OpenAI — API pricing (Standard, Batch, and tool rates, as read 6 November 2026): https://developers.openai.com/api/docs/pricing
  • OpenAI — Migrate to the Responses API: https://developers.openai.com/api/docs/guides/migrate-to-responses
  • OpenAI — Rate limits guide: https://developers.openai.com/api/docs/guides/rate-limits
  • OpenAI — GPT-Image-1 model page (shutdown notice, 23 October 2026): https://developers.openai.com/api/docs/models/gpt-image-1
  • OpenAI — text-embedding-3-small and text-embedding-3-large model pages: https://developers.openai.com/api/docs/models/text-embedding-3-small and https://developers.openai.com/api/docs/models/text-embedding-3-large
  • OpenAI — Agents SDK documentation: https://openai.github.io/openai-agents-python/
  • OpenAI — Vector embeddings (help centre): https://help.openai.com/en/articles/8984337
  • OpenAI — Introducing GPT-5 (model background): https://openai.com/index/introducing-gpt-5/

Prices and model availability are as listed by OpenAI on 6 November 2026 and change frequently. Re-check the pricing page and the model pages before spending money or building on a specific model ID.

Share to: , and

Faheem R. Khattak
Founder & Senior Editor

Senior automation engineer and AI marketing journo covering LLMs, algorithms, analytics, core updates, Bing search, and technical SEO.

✓ 10+ Years Covering Google Search & AI

0 Comments

Leave a Reply

Optional Take Tag:

🛡️ Spam protection: Honeypot + Time-Trap Active

This site uses Akismet to reduce spam. Learn how your comment data is processed.