EN ▾
Get API key

What Is an LLM Gateway? Plain Explanation

An LLM gateway is a single entry point between your application and one or more language model APIs. This page explains what it handles, when it is worth adding, and where this service sits.

Updated

Isometric arch gathering request streams from apps and sending them on to model servers

Key points

Verify that the endpoint strictly follows the OpenAI chat completions schema for drop-in compatibility.

Ensure the context window size matches your application's memory requirements to avoid truncation errors.

Implement streaming support to handle long-generation latency and improve user experience.

Confirm that privacy policies align with your data retention needs, especially regarding prompt storage.

The short definition

What is an llm gateway? It is a service or piece of code that sits between your application and the APIs of language models. Your app sends every request to one address, and the gateway decides what to do with it: check who is asking, pick a model or provider, enforce limits, forward the call, record what happened and return the answer. The app talks to one interface and does not care what is behind it.

The idea is borrowed from the API gateway used in web services for years. The difference is that the traffic is model calls, which are slow, billed by the token and often streamed, so a gateway for language models has a few jobs a normal one does not have.

Most gateways expose the same request format that the OpenAI SDKs use. That choice is practical. Nearly every client library, framework and tool already speaks it, so you can put a gateway in front of an existing app by changing one base URL.

What a gateway does

Different products offer different features, but the common set looks like this.

FunctionWhat it means in practice
Key managementProvider keys live in one place. Apps and teammates get their own keys, which you can revoke without touching the provider.
RoutingRequests go to a chosen model or provider by rule: by task, by user, by cost.
FallbackIf one backend fails or is slow, the request is sent to another.
Rate limitingPer-user or per-app caps stop one client from using up shared capacity.
Retries and timeoutsTemporary errors such as HTTP 429 are retried in one place instead of in every service.
Logging and cost trackingEach request is recorded with tokens, latency and spend, so you can see who costs what.
CachingIdentical requests can return a stored answer instead of paying twice.
GuardrailsInput and output checks, such as removing personal data before it leaves your network.

Not every project needs all of these. The value of a gateway grows with the number of apps, teams and providers behind it. With one script and one provider it adds a moving part and little else.

When you need one, and when you do not

A useful test is to count the pain you already have. A gateway pays for itself when you can answer yes to two or three of these questions.

  • Do several apps or teammates share the same provider account, and you cannot tell who spends what?
  • Have you hard-coded provider keys in more than one repository?
  • Do you want to switch models without redeploying every service?
  • Do you need automatic fallback when a backend returns errors?
  • Do you have to keep an audit log of prompts and answers?

If the answers are all no, skip it. A single bot or internal tool needs a base URL, a key, a timeout and a retry loop. You can always add a gateway later, and because the request format is the same, the change is small. Adding one early mostly gives you something extra to run and debug.

Where the cost shows up

A gateway can itself be a cost center. A self-hosted proxy needs a server, updates and monitoring. A managed one usually charges a fee or a margin on tokens; check the current pricing of whichever product you consider. Count that against the savings from caching, routing to cheaper models and fewer outages before you decide.

Three ways to get one

Write a thin layer yourself

For a small team this is often enough. A wrapper function that adds a timeout, retries 429 and 5xx responses, logs the token usage from the response and picks a model from a config file is about fifty lines. You keep full control and no extra service. The cost is that you maintain it, and every new need becomes your code.

Run an open-source proxy

Several open-source projects offer an OpenAI-compatible proxy with keys, budgets and routing. You host it, so prompts stay inside your infrastructure. You also take on upgrades, security patches and uptime. Check each project's documentation for the features it supports.

Use a managed gateway

A hosted product gives you the dashboard and the logs with no servers to run. In exchange you send traffic through a third party and accept its pricing, so read its data policy before sending sensitive prompts.

Where this service fits

Open LLM Gateway is not a router across vendors. It is a hosted, OpenAI-compatible API for one open-weight model, run by an independent provider and tuned to answer without content refusals for lawful adult use. It is not the official API of any model vendor. The model ID is uncensored, and the endpoint accepts POST /v1/chat/completions and GET /v1/models.

That makes it a clean backend for a gateway of your own. If your gateway holds a list of upstream providers, you add this one as an OpenAI-compatible upstream with the base URL below and send the requests that need a model without refusals to it. If you have no gateway, you can call it directly from your app. In both cases the setup is the same.

from openai import OpenAI

client = OpenAI(
    base_url="https://api.openllmgateway.com/v1",
    api_key="YOUR_KEY",
)

resp = client.chat.completions.create(
    model="uncensored",
    messages=[{"role": "user", "content": "Explain what a gateway does in two sentences."}],
)
print(resp.choices[0].message.content)

It supports streaming over SSE, tool calling, JSON mode, and the usual sampling parameters. It does text only: no images, audio, embeddings or fine-tuning. Prompts are not used for training.

What to plan around when it sits behind your gateway

Because the limits are fixed numbers, a gateway in front of this API can respect them from the start. A full key allows 8 concurrent requests and 300 requests per minute. A trial key allows 2 and 60. Over a limit the API returns HTTP 429 with the code rate_limited or concurrency, and temporary overload comes with a Retry-After: 5 header. Set the gateway's per-upstream concurrency to 8 or lower, and have it honor Retry-After.

Responses carry X-Request-Id and X-Balance-USD. Log the first for debugging and watch the second to alert you before the balance runs out. A streamed request holds its slot until the stream ends, so a gateway that buffers streams or leaves them half-read will waste capacity.

The context window is 100,000 tokens, prompt plus completion, and the maximum body is 8 MB. If your gateway adds a system prompt or injects history, count those tokens too.

For pricing, tokens are $0.15 per 1M input and $0.50 per 1M output, paid from prepaid credit with no subscription. A gateway that logs token usage makes the math easy. A day with 3M input tokens and 500,000 output tokens costs $0.45 + $0.25 = $0.70. Top-ups run from $20 to $500, with +5% from $50, +10% from $100 and +15% from $200, by card or crypto. Details are on the pricing page, and failed or refused requests are not charged.

Next steps

If you are deciding whether to put a gateway in your stack, read the AI gateway production checklist for the points to verify before you go live. To test the endpoint itself, the quickstart has the three-line client change, and getting a key takes a minute: sign up with Google or with an email and password, then claim the $0.50 trial credit with one click. The trial is valid for 7 days, needs no card and is limited to one per person.

Start without a gateway if your project is small. Add one when the second app, the second provider or the first audit request arrives, and keep the interface the same so that the move costs you almost nothing.

Questions and answers

Your key is one form away

Create an account, copy the key, change the base URL. That is the whole setup.

Get API key
Is an LLM gateway the same as an API gateway?

It is a related idea. An LLM gateway is built for model traffic, so it tracks tokens, handles streaming, and can route between models or providers.

Is Open LLM Gateway a router across several model vendors?

No. It is a hosted OpenAI-compatible API for one open-weight model, model ID uncensored, run by an independent provider. It can be one upstream behind your own gateway.

Do I need a gateway for a small project?

Usually not. A base URL, a key, a timeout and a retry loop are enough until several apps, teammates or providers share the setup.

Which request format do gateways use?

Most use the OpenAI chat completions format, so existing SDKs work after you change the base URL and key. This API uses the same format.

What limits should my gateway respect for this API?

A full key allows 8 concurrent requests and 300 per minute, and a trial key allows 2 and 60. Honor the Retry-After header on 429 responses.