Start Building
Technical

What Is an LLM API? Inference, Pricing, and Self-Hosting Explained

An LLM API exposes model inference. Here is what that means, how OpenAI-compatible and pricing actually work, and when a managed API beats self-hosting.

Author photo
packet.ai Team
August 28, 2026

An LLM API is a network endpoint that exposes model inference. Most people mean a hosted, managed version when they say it, one where a provider runs the model for you and bills per token, but the term itself just describes the interface, not who's running the infrastructure behind it. This is inference api explained from the ground up: what an llm api actually is, how it differs from self-hosting, what "OpenAI-compatible" means in practice, and when a managed API beats running your own GPU infrastructure.

Key takeaways

  • An LLM API is a network endpoint that exposes model inference; a managed LLM API specifically means a provider runs it for you and bills per token, not per hour of GPU time
  • "OpenAI-compatible" means the API follows the same request and response format OpenAI's API uses, so switching providers is often a one-line change to a base URL rather than a rewrite
  • Managed inference removes GPU provisioning, model loading, scaling, and uptime from your responsibilities entirely; self-hosting keeps those responsibilities with you in exchange for more control
  • The decision between the two usually comes down to utilization: consistently high-volume, steady traffic tends to favor self-hosting, while variable, low-to-moderate volume traffic tends to favor a managed API
  • Neither option is universally cheaper; the crossover point depends on your specific traffic pattern, not a fixed rule of thumb

This post assumes you already know what inference itself is, the process of running a trained model to generate output; that's covered in the packet.ai What Is LLM Inference guide. What's specific here is the API layer: how you actually access inference without running the infrastructure yourself.

What Is an LLM API?

An llm api is a network endpoint you send requests to, a prompt, some parameters, and receive a model's generated output back. Api llm access works the same way regardless of which provider you're calling: a request goes out, inference happens somewhere, a response comes back. What differs is who runs that "somewhere." When people say "llm api" in practice, they usually mean a managed one: the provider has already deployed the model, provisioned the hardware, and built the serving software, and your job is just to call the endpoint without touching any of that infrastructure yourself. This is llm api meaning at its most basic: an interface to inference, whoever happens to be running it.

For example, calling a frontier model through a major provider's API and calling an open-weight model through your own vLLM server are both, technically, LLM API requests. The difference isn't the interface, it's that only one of them requires you to manage GPUs. Training versus inference is a separate distinction entirely: training versus inference covers that split. An llm endpoint always runs inference, never training. The model was already trained by someone, elsewhere, before it ever reached the API.

What "OpenAI-Compatible" Actually Means

An openai compatible inference api implements the same request and response structure OpenAI's own API uses, most commonly the /v1/chat/completions endpoint shape: a list of messages in, a generated message out, with the same field names and the same optional parameters (temperature, max tokens, streaming, tool calling) behaving the same way. This matters practically because it's become a de facto standard, not because OpenAI mandates it. Many providers other than OpenAI itself implement this same shape specifically so that existing code, and existing tooling built around that shape, works against their llm rest api with minimal changes.

In practice, this usually means changing a base URL and an llm api key, and little else. Code written against one OpenAI-compatible provider commonly runs against another with those two changes, though model names and some provider-specific parameters still need adjusting. Most providers' llm api documentation includes a working llm api example using this exact request shape, which is often the fastest way to confirm compatibility before writing integration code. This is a meaningfully lower switching cost than a fully custom API shape would require, and it's a large part of why the format has spread beyond OpenAI's own service.

⚡ Compatible doesn't mean identical

Sharing a request format doesn't mean two providers behave identically. Rate limits, exact latency characteristics, which optional parameters are actually supported, and pricing all vary between OpenAI-compatible providers even when the wire format matches. Compatibility gets you a fast integration; it doesn't guarantee identical behavior once you're running against it.

LLM API vs Self Hosting: What Actually Differs

The inference api vs self hosting decision comes down to who's responsible for the infrastructure underneath.

Responsibility Managed LLM API Self-hosted
GPU provisioning Provider's job Your job
Model choice Limited to provider's catalog Any model you can run
Serving engine tuning Provider's job Your job (vLLM config, batching, etc.)
Idle cost None, pay per token used GPU cost continues whether used or not
Cost at sustained high volume Can exceed self-hosted cost Often cheaper at high, steady utilization

The core tradeoff is control versus operational overhead. Self-hosting, typically on a serving engine like vLLM, gives you full control over which model runs, how it's configured, and exactly what hardware it runs on, at the cost of managing all of that yourself. A managed llm api removes that operational burden entirely, at the cost of being limited to whatever models and configurations the provider offers.

When a Managed LLM API Beats Self-Hosting

Utilization is the variable that decides this more than any other factor. A GPU you're renting continues costing money whether it's processing requests or sitting idle; a managed inference API only bills for tokens actually processed. This means the math favors different approaches depending on how consistently busy your workload actually is, not on company size or how "serious" the use case is.

Bursty, unpredictable, or low-to-moderate volume traffic tends to favor a managed API, since the alternative is paying for GPU capacity that sits idle during quiet periods. Consistently high-volume traffic running at high GPU utilization around the clock tends to favor self-hosting, since at that point you're not paying for meaningful idle time either way, and self-hosting removes the provider's margin from every token. For the detailed cost math and where that crossover point actually sits, see the packet.ai LLM inference cost guide.

There's also a model-availability dimension separate from cost. There's no single best llm api for every use case; the right one depends on which models a provider's catalog actually includes. If a managed provider's catalog happens to include the specific open-weight model you need, an open-source llm api route can be the faster path to production regardless of the cost comparison. If your model isn't in any provider's catalog, or you need a specific fine-tune, self-hosting becomes the only option, cost aside.

LLM API Pricing: How Billing Actually Works

Nearly every llm api pricing model bills per token, with input and output tokens typically priced separately, since generating output requires more computation per token than processing input. This is a fundamentally different billing model from renting a GPU by the hour: a per-token bill scales with actual usage, while a per-hour GPU bill is fixed regardless of how busy that GPU actually is during the rental period.

A free llm api tier is worth understanding for what it actually is: nearly every major provider offers one, typically a fixed credit amount or a rate-capped free quota rather than unlimited free access. This is genuinely useful for evaluating whether a provider's output quality and integration fit your use case before committing to paid usage, but it's not representative of production-scale pricing, and no free tier scales to real traffic volume without eventually converting to paid.

Some providers layer a credit system on top of the underlying per-token rate rather than billing per token directly; understanding whether that abstraction is transparent or opaque matters for predicting your actual spend. The packet.ai Tokens vs Credits guide covers exactly how to evaluate that distinction. Separately, if your prompts share significant repeated content across requests, system prompts, retrieved documents, a provider's Prompt Caching Cost Savings guide covers a discount that can meaningfully change the effective per-token rate you actually pay, and it's worth reading alongside this section specifically, since caching often has the single biggest effect on a real LLM API bill.

Where Token Factory Fits

If you're weighing a managed API against self-hosting specifically because you don't want to commit to one model or one piece of infrastructure, that's the gap packet.ai's Token Factory is being built to fill: an OpenAI-compatible endpoint, per-token billing, and no GPU operations required on your end. It's currently in private preview, with the specific model catalog and pricing still being finalized.

Join the waitlist for early access once it opens.

Frequently asked questions

It's a network endpoint that exposes model inference. In most everyday usage, "LLM API" means a hosted, managed version: you send a request over the network and get the model's output back, typically billed per token, without needing to provision, configure, or manage any GPU infrastructure yourself.
Most major providers offer a free tier, typically a limited credit amount on signup or a rate-capped free quota, rather than unlimited free access. These are useful for testing integration and output quality but aren't representative of production pricing, and traffic beyond the free allowance converts to paid usage.
It means the API follows the same request and response format as OpenAI's own API, most commonly the /v1/chat/completions shape. This lets code written against one OpenAI-compatible provider typically run against another with just a base URL and API key change, rather than a full integration rewrite. It doesn't guarantee identical performance, pricing, or feature support between providers.
It depends on utilization, not a fixed rule. A managed API tends to be cheaper for bursty, unpredictable, or lower-volume traffic, since you avoid paying for idle GPU capacity. Self-hosting tends to be cheaper at consistently high, steady utilization, since at that point you're not paying for meaningful idle time and avoid the provider's margin on every token.
An inference API only runs inference, using an already-trained model to generate output. It never trains anything. Training happens separately, before the model is deployed, whether by the provider itself, an open-source lab, or someone who fine-tuned an existing model.

Last reviewed: August 31, 2026. For the fundamentals of inference itself, see the What Is LLM Inference guide. For the full cost comparison between self-hosting and managed APIs, see the LLM inference cost guide.

Waste less compute.

Same models. Same API. Fraction of the cost. Start free — no credit card required.

Start Building →

More from the blog