Intermediate

API: how software plugs into AI models

An API (application programming interface) is a set of rules that lets one program send requests to a service and receive its responses. In AI, the API is how apps, automations and agents reach models directly, without going through the chat interface.

Data as of October 22, 2026

Key figures

LevelIntermediate

A simple definition

Think of a service counter. You can’t see what happens in the back office, but you know which form to fill in and what kind of answer to expect. An API is that counter for software: it defines the format of requests (which address to call, what information to include) and the format of responses. For AI models, it’s usually a web API: the program sends an HTTP request containing a prompt and some settings, and gets back text, often as JSON.

Anthropic’s documentation describes its API as a REST API at a single address, with endpoints to send messages, count tokens or process batches. OpenAI works on the same principle.

A concrete example

An online store wants a product description written automatically for every new item. Its software sends the product name, specs and a style guideline to a model’s API; a few seconds later it receives the description and saves it to the product page. Nobody opens a chat window: it all happens between two programs. With tool calling, the exchange can even go the other way: the model asks the program to perform an action, such as checking stock levels.

Why it matters

The API is what turns a model into a building block. AI agents, automations and most “AI-powered” apps rely on it. It also changes the cost model: you pay by price per million tokens, and usage can add up quickly. To estimate a bill in dollars before you build, try our agent cost calculator.

Common mistakes

  • Exposing your API key in a web page’s code or a mobile app: anyone can extract it and run up charges on your account.
  • Ignoring rate limits. Past a certain number of requests per minute, the API rejects calls; robust software waits and retries.
  • Assuming the API behaves exactly like the app. The app adds its own instructions, tools and settings; through the API, defining them is up to you.

Related terms: API key, rate limit, tool calling, structured output, Model Context Protocol (MCP).

Related terms

Try it

Full glossary

Frequently asked questions

What's the difference between the ChatGPT or Claude app and their API?

The app is built for a person: an interface, chat history, a monthly subscription. The API is built for a program: you send a request, get a response, and usually pay per use, by the token. They are billed separately: a consumer subscription does not include API usage.

Do I need to code to use an AI API?

Not necessarily. No-code automation tools offer ready-made blocks that call the providers' APIs. You still need a developer account and an API key.

How does the API know who I am?

Each request carries a secret identifier, the API key, or a short-lived access token. That is how the provider bills you and applies your usage limits.

Does an AI API remember previous exchanges?

By default, most calls are independent: for a conversation, your program resends the history with each request. Some providers offer options to keep state on their servers; in that case, read their data retention terms.

Data sources

Data as of October 22, 2026

Report an error

Does a figure, a date or a fact look wrong? Tell us: every report is checked.