What is an API in AI? Plain-English guide
A way for one program to talk to another. Developers use AI APIs to add AI features to their own apps.
Last reviewedIn plain English
An API, short for application programming interface, is a set of rules that lets one program talk to another. You can think of it as a waiter: your program places an order, the waiter carries it to the kitchen, and brings back what comes out. You never need to see the kitchen.
How it works with AI
When you use a chatbot in a browser, you type into an app made by the AI company. An AI API lets developers do the same thing from their own code, so a prompt can come from a website, a spreadsheet or a script instead of a chat window.
The steps are always similar:
- Your program sends a request with a prompt and some settings.
- The AI provider runs the model on it.
- A reply comes back, which your program can show, save or act on.
Why it matters
- It is how AI gets built into products. Customer-support tools, writing assistants and search features often call an AI API behind the scenes.
- You usually pay for what you use. Providers commonly charge per token, for both the text you send and the text that comes back. Our guide to estimating AI API costs shows how to budget.
- A chat subscription and API access are usually separate things, and are normally billed separately.
Keep your key safe
To use an API you are given a secret key. Anyone who has the key can make requests that you pay for.
- Never paste a key into a public chat, a forum or a screenshot.
- Never put it in code that runs in the browser, where visitors can read it.
- If it leaks, replace it straight away and set a spending limit where your provider allows one.
Common mix-ups
- An API is not an app. It has no screen. It is the connection that apps use.
- Free in the chat app does not mean free through the API. The two are priced differently.
Related terms
- Agent (AI agent)An AI system that can plan steps and use tools (like search, email or code) to complete a goal, not just answer one message.
- InferenceThe moment a trained model is used to produce an answer. Each chat reply is an inference.
- ModelThe trained AI 'brain' that produces outputs. Companies release different models with different strengths and prices.
Keep reading
- GuidesHow to estimate AI API costs, with a worked example5 min read
- GuidesWhat is a token in AI? A plain-English guide5 min read