API turns up in every discussion about building anything with AI, usually without explanation. It stands for application programming interface, which helps nobody. The useful way to think about it is as the difference between a shop and a wholesaler: one is designed for a person to walk into, the other for another business to order from in bulk.
What is an API in practice?
A defined way for one piece of software to ask another piece of software to do something. Your program sends a structured request over the internet, the provider's system processes it, and a structured response comes back. No screens, no buttons, no person.
For AI specifically, the request contains your prompt and some settings, and the response contains the model's output plus information about how many tokens were used.
How does it differ from using the website?
- No interface. You write code, or use a tool that writes it for you.
- No system prompt. The provider's own instructions are absent, so behaviour differs from the consumer app.
- No memory or history. Every request stands alone unless your program sends the conversation with it.
- Billing by use. Charged per token rather than a monthly subscription.
- More control. Model version, temperature and output limits are yours to set.
That third point catches people out. A conversation through an API only has continuity because your program resends the whole history each time.
What is an API key?
A long string of characters that identifies your account on every request. It is a password with a bill attached, and treating it as anything less is the most common expensive mistake in this area.
Keys committed to a public code repository are found within minutes by automated scanners and used until someone notices. Every provider offers spending limits and alerts, and setting both before the first request is the sensible order to do things in.
What does it cost?
Priced per million tokens, with input cheaper than output, often by a factor of three to five. Small models cost a fraction of large ones. For a personal project handling a few hundred requests a month, the total is frequently less than a subscription; for anything at volume, the difference between models becomes the dominant cost.
Two things reduce a bill quickly. Caching, where repeated context is discounted heavily. And choosing a smaller model for the parts of a workflow that do not need a large one, which is usually most of them.
Who actually needs one?
Anyone building software. Anyone processing more material than a person could paste by hand, such as thousands of records to classify. Anyone needing consistent output at a fixed model version rather than whatever the consumer app was updated to overnight.
Nobody who simply wants to use AI. If your work happens in a chat window, the API adds cost and complexity for no benefit at all.
Do you need to be a programmer?
Less than you did. Automation platforms now connect AI models to other services without code, spreadsheets can call models from a formula, and asking an assistant to write the script is a realistic route for something simple.
What you cannot skip is understanding what you have built. Handing an API key to a tool you do not understand, connected to systems you care about, is how small experiments become incidents.
Are all AI APIs the same?
Close enough that switching is not difficult. The major providers use similar request formats, and several deliberately match the most widely adopted one so that existing code works with minimal change. Libraries exist that sit in front of several providers at once, which is worth using if you want the option of moving without rewriting anything.
What is worth knowing before starting?
Pin the model version rather than using a name that moves, or your workflow will change behaviour without warning. Handle failures, since requests time out and rate limits exist. Log what you send and receive while developing. And set a spending cap on day one, because the difference between a test and a loop that runs ten thousand times is one missing condition.