# LLM API

> A web service your code calls to get text back from a big AI model.

**Field:** Software Development  
**Category:** AI Engineering  
**Also known as:** Large Language Model API, Model API, AI API

## Think of it like

Think of it like ordering food by phone. You say what you want, and the kitchen sends it back.

## Definition

An LLM API is a web service that lets your code send text to a large language model and get its reply. Your app sends a request with a secret key, the model's name, the messages and limits such as the most tokens to write. The provider runs the model on its own computers and sends back the answer. Each call is charged by the tokens it uses. Most apps that use AI talk to a model this way rather than running one themselves.

## Example

Jack's help app sends each customer question to the OpenAI API with a short system prompt. The reply comes back in about two seconds. It goes straight into the chat.

## Example code

```json
{
  "model": "model-name",
  "max_tokens": 300,
  "messages": [
    { "role": "user", "content": "Summarize this email." }
  ]
}
```

A request says which model to use, how long the reply can be, and what to say.

## Why it matters

It puts the best models one web call away. You have no machines to buy or run.

## Common mistake

Putting the API key in code that runs in the browser. Anyone can copy it from there and spend your money.

## Three principles

- **Request and reply.** Text in, text out.
- **A secret key.** Kept on the server.
- **Paid per token.** Every call costs.

## Related terms

- [Application Programming Interface (API)](https://learn.benibix.com/term/development/api)
- [API Key](https://learn.benibix.com/term/development/api-key)
- [Token Usage](https://learn.benibix.com/term/development/token-usage)
- [Large Language Model (LLM)](https://learn.benibix.com/term/ai/large-language-model)
- [LLM Streaming](https://learn.benibix.com/term/ai/streaming-response)
- [Claude API](https://learn.benibix.com/term/development/claude-api)
- [OpenAI API](https://learn.benibix.com/term/development/openai-api)

## Told apart from

- [LLM API vs Client SDK](https://learn.benibix.com/compare/llm-api-vs-client-sdk): People think the SDK and the API are the same thing, because both carry the model maker's name. The API is the service on the model maker's servers. It takes web requests and sends back replies. The client SDK is a code library on your side. It builds those web requests for you, so you call a function instead.

## Taught in

- [OpenRouter and Model APIs](https://learn.benibix.com/learn/ai-models-providers/openrouter-and-model-apis): AI Models and Providers, 13/13

![An app sends a request with a key, the model name and the messages to the provider's server. The model writes a reply, which comes back with a count of tokens used.](https://learn.benibix.com/diagrams/dev-llm-api.svg)

---

Source: https://learn.benibix.com/term/development/llm-api
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-20
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
