Application programming interface (API)

An application programming interface (API) is a defined way for one piece of software to request a service from another, and it is how most businesses and developers use AI models.

An API is a contract between two programs. One side publishes a list of requests it will accept, what each request must contain and what it will send back. The other side follows that list and gets the service without needing to know how it works inside. A weather service might accept a request naming a city and return a forecast; a shipping company might accept an order and return a price and a tracking number.

On the web, an API usually means sending an HTTP request to a particular address, called an endpoint, and getting a structured reply, usually in JSON. In AI this is how most people outside the big labs use the big models. A developer sends a request to an address such as Anthropic's messages endpoint, with a secret API key, the name of the model, a limit on the length of the answer and the conversation so far. The model runs in the provider's data centre and the reply comes back as data that the developer's own software can display, store or act on.

The idea is old. In the 1940s Maurice Wilkes and David Wheeler built a library of reusable routines for the EDSAC computer, and documented each one in a catalogue that resembles modern API documentation. The phrase application program interface first appears in a 1968 conference paper by Ira Cotton and Frank Greatorex. In 2000 Roy Fielding's doctoral dissertation described REST, the style most web APIs now follow. The directory ProgrammableWeb tracked 105 web APIs in 2005 and more than 24,000 by 2022.

For AI companies the API is also the business model. Products such as chat apps are one way to reach users, but selling access to models through an API lets thousands of other companies build them into their own software, usually paying by the amount of text processed. When a news story says a model is available through the API, it means developers can call it from code rather than only through the company's own app.

The trade-off is dependence. Software built on someone else's API relies on that provider's prices, limits, uptime and decisions about which models to keep running. Teams that care about this keep the option of switching providers or of running an open-weight model themselves.

Common questions

What is an API in simple terms?

An API is a set of rules that lets one program ask another program to do something and get an answer back. It defines which requests are allowed, what information each one needs and what the response looks like. People rarely see APIs directly, but most apps rely on them.

What does it mean to use an AI model through an API?

It means your software sends a request over the internet to the model provider, including your prompt and settings, and receives the model's output in reply. The model runs on the provider's hardware. You pay for what you use and authenticate each request with an API key.

What is an API key?

An API key is a secret string that identifies the account making a request, so the provider can authorise it, apply limits and bill for it. It works like a password for software, so it should be kept out of public code and rotated if it leaks.

What is the difference between an API and an app?

An app is built for people to use through a screen. An API is built for software to use through code. Many AI companies offer both: a chat app for individuals and an API that developers use to put the same models inside their own products.

Finding more

Search for "what is an API", "REST API" and the name of an AI provider plus "API reference" to see real requests and responses. The most reliable sources are providers' own API documentation, which shows exact request formats, limits and prices, and well-cited encyclopedia articles for history. Third-party tutorials can go out of date quickly as providers change their interfaces.

  • APIReferenceDefinition and history of APIs, from the EDSAC library to the 1968 first use of the term and REST in 2000.
  • Web APIReferenceHow web APIs, endpoints and JSON responses work, with growth figures from ProgrammableWeb.
  • Extended thinking (Claude API documentation)OfficialShows a complete API request to a model provider's messages endpoint, with key, model and parameters.
  • Batch processing (Claude API documentation)OfficialShows model access priced per million tokens of input and output.

Working out what this means for your business?

Aileron Shift builds the systems behind this site: AI newsrooms that research, write and publish on their own, marketing automation and WordPress hosting for companies that need to move faster than their competitors.