LLM API

What is LLM API?

An LLM API is a programming interface through which applications send requests to a large language model hosted by a provider and receive its responses, usually paying per token processed.

Updated November 2026 · 2 min read


An LLM API is a programming interface that lets an application send requests to a large language model hosted by a provider and get responses back, usually paying per token. It is how most organizations use large language models. Instead of running a model themselves, they send requests over the internet to a provider that hosts it and receive responses, paying for the tokens processed. A few lines of code give an application access to models that would cost millions to build and require specialized hardware to run.

LLM APIs are offered by model developers directly and through cloud platforms, which host models from several developers. Most follow similar patterns: send a list of messages, receive a generated response, and pay per million input and output tokens.

What can an LLM API do?

  • Text generation and chat with system instructions and conversation history.
  • Streaming, so responses appear as they are generated.
  • Structured output, such as responses guaranteed to match a JSON format.
  • Tool use, where the model can request calls to functions the application defines.
  • Multimodal input, such as images, documents and audio.
  • Embeddings, for search and retrieval.
  • Cost features: prompt caching, batch processing and provisioned throughput.

API vs. self-hosting

LLM APISelf-hosted model
Upfront effortLowHigh
Cost modelPay per tokenPay for GPUs and staff, whether used or not
Access to top modelsYesLimited to open-weight models
Control over data and versionsDepends on provider termsFull
ScalingHandled by provider, within rate limitsYour responsibility

Things to watch

  • Rate limits: caps on requests and tokens per minute, which can block growth if not planned for.
  • Model versions: providers update and retire models. Pin versions where possible and test before switching.
  • Data terms: what the provider does with prompts and outputs, including retention and use for training.
  • Reliability: outages and slowdowns happen, so important applications need fallbacks.
  • Cost visibility: usage spread across many keys and teams is hard to track. See AI gateway.

An example

Consider a hypothetical startup that builds its product on one provider's LLM API. When the provider has a four-hour outage during a product launch, the startup's main feature stops working. Afterward, the team adds a gateway that can route requests to a second provider's comparable model if the first fails, pins model versions and keeps an evaluation set to check that both models give acceptable results. The next outage causes a short slowdown rather than a failure.

LLM API usage is the main component of LLM cost for most organizations, priced as described in cost per token.

Frequently asked questions

Should you use an LLM API or self-host a model?

An LLM API needs little upfront effort, charges per token, offers access to top models and leaves scaling to the provider within rate limits. Self-hosting gives full control over data and versions but limits you to open-weight models and means paying for GPUs and staff whether or not they are used. See self-hosted LLM.

What risks should teams plan for when building on an LLM API?

Plan for rate limits that can block growth, model updates and retirements that change behavior, and provider outages. Check data terms on retention and training use. Pin model versions where possible, keep an evaluation set to test replacements and add a fallback provider for important applications so an outage causes slowdowns rather than failures.

What features do LLM APIs typically offer besides text generation?

Most LLM APIs support streaming responses, structured output that matches a JSON format, tool use where the model requests calls to functions the application defines, and multimodal input such as images, documents and audio. Many also provide embeddings for search and cost features such as prompt caching, batch processing and provisioned throughput.

Book a demo