What it is
An API is a doorway that lets one piece of software ask another piece of software to do something. The letters stand for "application programming interface", which is a mouthful that mostly means "the agreed way for programs to talk to each other". When people talk about an AI API, they mean the doorway into a model such as GPT, Claude or Gemini that a program can use directly, without a person typing into a chat window.
The easiest way to picture it is a restaurant with an order window. You don't walk into the kitchen, you don't see the ovens, and you don't need to know how the chef makes the sauce. You go to the window, you place an order in the form the restaurant accepts ("one number 4, no onions"), and a few moments later a meal comes back through the same window. The kitchen is the model, running on the AI company's computers. The window is the API. The order slip is your request, and the meal is the response.
A request to an AI model through an API is a small, tidy package of text. It usually says:
- Which model you want. The menu has several dishes, from small fast models to large careful ones, each priced differently.
- The instructions and the message. The standing instructions, known as the system prompt, and the actual question or task.
- Any earlier messages. If this is part of a conversation, the program sends the history too (more on why in a moment).
- The settings. Things like the maximum length of the answer and the temperature, which controls how varied the wording is.
The response comes back as text the program can read: the model's answer, plus a note of how many tokens went in and came out, which is what you're billed for. The program can then do anything it likes with that answer: show it on a web page, put it in a spreadsheet cell, send it in an email, or pass it to another step.
That's the whole trick. Every "AI-powered" feature you've seen inside another company's app, the writing helper in your email, the chatbot on a shop's website, the summary button in a note-taking tool, is almost always that app sending orders through an AI company's window and showing you what comes back.
How it differs from the chat app
The chat app (ChatGPT, Claude, Gemini) and the API often use the same underlying models, but they are different products, and the differences surprise people.
- Payment. A chat app usually costs a flat monthly subscription, or nothing at all. An API is pay-per-use: you pay for every token you send and receive. A light user may pay pennies; a busy app can pay thousands. The Inference and Tokens articles explain how those prices are worked out.
- Memory. The API has no memory of its own. Each request stands alone, like an order window that has never seen you before. If you want the model to remember what was said earlier, your program must send the whole conversation again with every new message. The chat app does this for you behind the scenes, which is why it feels like it remembers.
- Control. In a chat app the company writes the system prompt and picks most of the settings. Through the API, you write the system prompt yourself and choose the settings, which is exactly why businesses use it.
- No extras by default. The chat app bundles features such as web search, file uploads and image tools. A basic API call gives you the model and nothing else, unless you switch those features on or build them yourself.
- Data terms. Companies often treat API data differently from consumer chat data, for example in whether it's used for training. The terms vary by company and by plan, and they change, so check the current policy of the service you use.
Why it matters
It's how AI gets into everything else. Most people will meet AI far more often inside other products than in a chat app. Almost all of those features run on an API. If you understand the order window, you understand what's really happening when an app you use says it "uses AI", and you can ask sensible questions: which model, whose servers, and what happens to what I type?
It turns a one-off chat into a repeatable process. Pasting a hundred product descriptions into a chatbot one at a time is tedious. A small script or an automation tool can send all hundred through the API with the same instructions and collect the answers in a spreadsheet. This is the foundation of workflow automation and of every agent that works on its own.
It's where the money is spent. Businesses buy AI mostly through APIs, by the token. That's why prices per million tokens make headlines, and why a small change in a prompt that runs ten thousand times a day can change a monthly bill noticeably.
It gives you control the chat app doesn't. With the API you choose the exact model version, write your own system prompt, and set the output format, which matters when the answer has to slot neatly into another program (see Structured Output). Tools such as Function Calling and MCP build on this, letting the model ask your software to do things.
It carries real risks for the unwary. Access to an API is controlled by a secret code called an API key. Whoever holds the key can spend your money. Understanding this one fact would have saved many people a nasty bill, as the examples below show.
Real-world examples
OpenAI opens its window (June 2020)
On 11 June 2020, OpenAI announced its API, a general-purpose "text in, text out" doorway to its new GPT-3 model. It launched as a private beta: developers had to apply for access, and about a dozen companies had already been testing it on things like chatbots, teaching aids and legal research. TechCrunch reported OpenAI's reasoning that it felt safer to release the model through an API and widen access over time than to publish the model itself, because an API let the company watch how it was used and cut off harmful uses.
That choice shaped the industry. Instead of downloading a model, developers rented access to one, paying per use. The order window, rather than the recipe, became the product. Most of the big AI companies have sold their best models this way ever since.
The ChatGPT API and a tenfold price cut (March 2023)
ChatGPT launched to the public in late November 2022, but at first developers couldn't build it into their own products. That changed on 1 March 2023, when OpenAI released an API for the model behind ChatGPT, called gpt-3.5-turbo. It was priced at $0.002 per 1,000 tokens, which OpenAI said was ten times cheaper than its existing GPT-3.5 models, and the company said it had cut the cost of running ChatGPT by 90 percent since December through system-wide improvements.
Early customers were named on the day. Snap used it for My AI, a chatbot for Snapchat+ subscribers. Quizlet built a study tutor called Q-Chat, Instacart built a shopping helper called Ask Instacart, and Shopify used it too. OpenAI also changed its data policy: according to TechCrunch, data sent through the API would no longer be used for training by default, and would be kept for 30 days. Within weeks, AI features built on the API were appearing in apps that millions of people already used.
Duolingo Max: a product built on someone else's model (March 2023)
On 14 March 2023, the same day OpenAI released GPT-4, the language-learning company Duolingo announced Duolingo Max, a new subscription tier with two features built on GPT-4 through OpenAI's API. "Explain My Answer" gives a plain-language explanation of why an answer was right or wrong. "Roleplay" lets learners practise conversations with characters in the app, such as ordering at a café. At launch it cost $29.99 a month or $167.99 a year and was limited to Spanish and French courses for English speakers on iPhone.
This is the typical shape of an API product. Duolingo didn't build a language model. It built lessons, characters and a user experience, and sent carefully written requests through the window to a model it rented. The same pattern sits behind a large share of the AI features you'll meet.
Claude's API opens to 159 countries (March 2024)
Anthropic had offered Claude to businesses through an API before, but on 4 March 2024, when it launched the Claude 3 model family, it announced that the Claude API was generally available in 159 countries. Two of the three new models could be used through the API that day. The detail worth noticing is the words "generally available": from then on, any developer in those countries could sign up and start sending orders, rather than waiting for approval. At the time of writing, the three biggest model makers all sell their models this way alongside their chat apps.
The $82,000 key (February 2026)
In March 2026, The Register reported the story of a developer at a three-person startup in Mexico who had posted on Reddit about a bill of $82,314.44 for Google's Gemini API, run up over two days, 11 and 12 February 2026. The team's normal spend was about $180 a month. Their API key had been compromised, and someone else had used it to run the model at scale. According to The Register, Google pointed to its "shared responsibility model", under which customers must secure their own keys.
The story was part of a wider problem. Weeks earlier, the security company Truffle Security had published research showing that some older Google API keys, originally created for services such as Maps and often visible in websites' code, could also unlock Gemini once it was switched on in the same project. It found 2,863 live keys exposed that way. Google has since changed how Gemini API keys work, and by its own documentation new keys are a more restricted type.
The problem isn't limited to one company. GitGuardian, which scans public code on GitHub for leaked secrets, reported in March 2026 that it found 28.65 million secrets such as passwords and keys in public GitHub code during 2025, and that leaked keys for AI services had risen 81 percent in a year, to more than 1.27 million. An API key is a password to your wallet, and people leave them lying around.
An everyday case: the newsletter summaries
Here's an illustrative scenario, not a real business. Priya runs a weekly newsletter and wants a two-sentence summary of each of the thirty articles she links to. Doing it in a chat app means thirty rounds of copy and paste. Instead, she uses a no-code automation tool that watches her spreadsheet: whenever she adds a link and the article text, the tool sends it through a model's API with her instructions ("summarise in two sentences for busy readers, no hype") and writes the answer into the next column.
She pastes her API key into the automation tool, not into anything else, and sets a monthly spending limit of a few dollars in the AI company's billing settings. The first month costs well under the price of a coffee. When she accidentally points the automation at a list of 3,000 links, the spending limit stops it before the bill grows, and the only harm is a pile of summaries she didn't need.
Try it yourself
You need a web browser and a Google account. At the time of writing, Google says AI Studio is free to use in all the regions where it's available, and the Gemini API has a free tier with limited access to some models. Google's pricing page also says that on the free tier your content may be used to improve its products, so use made-up or public text, never anything private. Check the current terms yourself. Allow about twenty minutes.
Anthropic's Console and OpenAI's Playground offer similar workbenches, but at the time of writing both bill against prepaid API credit, so you'd need to add a payment method and buy credit first.
- Open the workbench. Go to aistudio.google.com and sign in. You'll see a chat-style screen. This is a playground for the API: everything you do here can be turned into an API request.
- Write standing instructions. Find the system instructions field (in Google's quickstart it sits under Run settings). Paste this:
You write product descriptions for a small online shop that sells handmade candles. Keep each description under 50 words, warm but not gushing. Never invent prices, ingredients or burn times that you are not given.
- Send an order. In the main box, paste this and run it:
Write a description for: "Autumn Walk" soy candle, scents of cedar and apple, 200 g, cotton wick.
- Change a setting. In the run settings, find temperature and change it, then run the same message again. Notice that you are now choosing settings the chat apps normally choose for you. (The Temperature article explains what the dial does.)
- Look at the order slip. Click Get code. You'll see your conversation turned into the text a program would send through the API: the model's name, your system instructions, your message, and your settings, all in one package. Don't worry about the programming language. Just find your own words inside it. That package is an API request.
- Notice what's missing. Look for your API key in that code. You'll see a placeholder instead. The key is always kept separate, because it's the one part that must stay secret.
- Test the memory point. Ask a follow-up ("Now make it shorter"), then click Get code again. You should see that the earlier messages are included in the request. That's the conversation history being sent back each time, because the model itself remembers nothing between requests.
- Optional, only if you'll use it: make a key. If you plan to connect an automation tool, create an API key from the "Get API key" page. Store it in a password manager. Never paste it into a website, a chatbot, a shared document, an email, or a forum post asking for help. If you ever think it's been seen, delete it and make a new one.
- Set a spending limit before you pay for anything. If you later move to a paid plan with any provider, find the billing or limits page and set a monthly cap you'd be comfortable losing. At the time of writing, Anthropic's Console, for example, lets you set your own monthly spend limit below your account's cap.
Using an API without writing code
You don't have to program to benefit from an API. Automation services such as Zapier and Make, and add-ons for spreadsheets, connect to AI models through their APIs for you. Usually you create an API key with the AI company, paste it into the tool's connection screen once, and then build a recipe: "when a new row appears, send this text to the model with these instructions, and put the answer here". You pay the automation tool for its service and the AI company for the tokens, separately. Features and prices change often, so check both companies' current terms before you rely on them.
Common mistakes and misunderstandings
Treating an API key like a username. An API key is closer to a credit card number with no spending limit. Anyone who has it can use the service on your account. Don't put it in a web page, a shared spreadsheet, a screenshot or a public code folder, and be wary of any website that asks you to paste one in so it can "use your own AI". Only give a key to a tool you trust, and prefer tools that let you revoke it easily.
Skipping the spending limit. Pay-per-use has no natural ceiling. A runaway automation, a loop that sends the same request forever, or a stolen key can run up charges fast. Set a monthly cap and turn on billing alerts on day one.
Thinking the API remembers. Each request starts fresh. If a chatbot built on an API seems to forget things, it's usually because the program didn't send the history, or the history was cut to save money. Sending the full history every time also means each message costs more than the last, which the Tokens article explains.
Assuming the API and the chat app behave identically. The chat app has a company-written system prompt, extra tools and chosen settings. The bare API has whatever you give it. The same model can sound quite different in each, and that isn't a bug.
Being surprised by rate limits. Every provider caps how much you can send in a given time, usually counted in requests per minute and tokens per minute. At the time of writing, Anthropic's documentation says new accounts start on lower limits that rise with usage history. Go over a limit and you get an error (often numbered 429) telling you to wait. It's the kitchen saying "we're full, try again in a moment". Well-built tools wait and retry; if you're running a big batch, slow it down or spread it out.
Forgetting that models change and retire. Providers release new model versions and switch off old ones on a published schedule. A tool that names an old model may stop working. Check the provider's deprecation notices if something that worked last month suddenly fails.
Sending private data without checking the terms. Whatever you send through the window goes to the company's servers. Read how long they keep it and whether it's used for training, especially on free tiers. The Privacy article covers what to ask.
Believing API means "for programmers only". Programmers use it most directly, but anyone using a no-code automation tool, a spreadsheet add-on or a writing app is using an API, just with someone else writing the order slip.
Related elements
- Tokens: the unit every API request is measured and billed in.
- Inference: what happens in the kitchen when your order arrives, and why it costs what it does.
- System Prompt: the standing instructions you write yourself when you use an API.
- Temperature: one of the settings the API lets you choose.
- Context Window: the limit on how much history and text one request can carry.
- Structured Output: getting answers back in a fixed format another program can read.
- Function Calling: how a model, through the API, asks your software to take an action.
- MCP: a shared standard for connecting models to tools and data, built on top of API calls.
- Workflow Automation: chaining API calls together so work runs without you.
- Privacy: what happens to the text you send through the window.