An LLM gateway is one endpoint and one key in front of many models, and a direct API is the model maker’s own endpoint with its own key. Which one wins depends on four things you can count: how many providers you call, how much failure you can tolerate, who needs a spending cap, and how much you spend a month. Most posts on this topic pick a side. This one gives you a five-question decision flow, a break-even calculator you can edit with your own spend and hourly rate, a table of what each route does with sources read on 28 November 2026, and the cases where we tell you to go direct. We publish this post, so weigh our side accordingly: the arithmetic is shown so you do not have to take our word for any of it.
What do “direct” and “gateway” mean in practice?
Direct means your code calls the provider that trains or hosts the model: an OpenAI key against OpenAI, an Anthropic key against Anthropic, a Google key against Gemini. You get that provider’s newest features first, one invoice per provider, and no other company in the path. You also get that provider’s outages, limits and billing rules, one set per provider.
A gateway sits between your code and those providers. In practice the word covers three different shapes, and the trade-offs differ, so it helps to separate them:
- A hosted router with its own model access. You hold one key with the gateway, pay it, and it pays the providers. OpenRouter and One AI API Key are this shape. Your provider keys are not in your code at all.
- A hosted proxy over your own provider keys. Cloudflare describes AI Gateway as analytics, logging, caching, rate limiting, request retries and model fallback for the providers you already use, started with one line of code. You keep your provider contracts and bills; the proxy adds control. Our post on what Cloudflare AI Gateway does not do covers the limits of that shape.
- A proxy you run yourself. LiteLLM is one well-known example. You own the uptime, the upgrades and the supply chain, a point the March 2026 incident makes concrete (more below). The head-to-head is in LiteLLM against a hosted gateway, and the longer option list is in LiteLLM alternatives.
Where we say “gateway” without qualification below, we mean the first shape, because that is the one that raises the trust and fee questions. The deeper explainer is what an LLM gateway is.
When does calling the provider directly win?
Direct wins more often than gateway marketing admits. Seven cases, each with the reason.
You use one model at one provider. A gateway’s core jobs are switching, failover and a single bill across providers. With one provider none of those exist, and the gateway is a second company in a path that worked without it. Add one when your situation changes, not before.
You rely on a provider’s native features. Anthropic’s own OpenAI-compatibility page, read on 28 November 2026, says that layer is primarily intended to test and compare model capabilities, and is not considered a long-term or production-ready solution for most use cases. It lists what is lost in translation: the strict flag for function calling is ignored, response_format accepts only json_schema with strict: true, audio and file inputs return a 400, and prompt caching is not supported there. That page describes Anthropic’s own compatibility endpoint, not any gateway, but the lesson transfers. Any layer that converts one API format into another can drop features, so if you depend on caching, structured output or file inputs, check whether the gateway passes the native format through. Ours exposes a native Messages endpoint for that reason, documented under Anthropic Messages, and the prompt caching docs say what is supported. Verify the exact feature you need, not the logo.
Your data rules allow only named processors. A gateway is one more party that relays the request. If a contract, a customer or a regulator says “these two processors and no others”, a middleman is a conversation you have to win. The honest answer then is direct, or a proxy you host yourself. Our privacy post states what we keep (counts, not content) and what we cannot promise about the company running the model.
Your spend is high enough that a percentage fee hurts. A fee of 5.5 percent on credit purchases is small at $500 a month and large at $20,000. The worked example below shows where the lines cross. If a provider will give you committed-use or volume terms directly, a gateway often cannot match them.
You need the new feature on release day. A provider ships a capability in its own API first. A gateway supports it after its own engineering work. If you build on features that are weeks old, going direct avoids the wait.
You want the shortest possible path. One more hop adds some time. Whether it matters depends on your product: it is invisible in a batch job and visible in a voice agent. We have not measured a latency figure for this post, so we do not quote one; the script further down measures it for you.
You already have limits and a relationship you are happy with. Providers set rate limits per organization and raise them with usage history. Anthropic says its limits are enforced at the organization level and that new organizations may begin in an Evaluation tier below the standard limits. If you have climbed those tiers, you carry that history with you only when you call the provider directly.
When does a gateway win?
A gateway wins when the work it replaces is bigger than its cost. Six cases, again with reasons.
You call more than one provider. Each direct provider means its own key, its own SDK quirks, its own billing page and its own rate-limit rules. A gateway collapses that into a base URL, a key and a model id. Most OpenAI-style SDKs accept a base URL, so switching a model across providers becomes an edit to one string. Our guide to switching an OpenAI SDK app to a different base URL shows the change, and OpenAI API alternatives lists what differs.
You need failover you do not want to write. Providers fail. Anthropic documents a 529 overloaded_error that can occur when the API experiences high traffic across all users, and the SDK’s default is to retry a failed request up to two times. Retrying the same provider does nothing when the whole provider is overloaded. A router that tries another model does. OpenRouter’s fallback documentation describes a models array tried in priority order on context-length errors, moderation flags, rate limiting and downtime, and says the request is priced at the model that ultimately answered. We built the same idea differently, and the rules are in the next section. The practical walk-through is in uptime and fallbacks, and DeepSeek API down, keep your agent running applies it to one provider’s outage.
You want a budget per key or team. Anthropic documents limits you can set per workspace inside an organization, but a provider key still belongs to one account. A gateway can give each service its own key with its own limit, so a runaway loop in one service stops at that key’s cap instead of draining the account. AI agent runaway token bill works through the loop arithmetic, and our cost-control documentation shows the per-key limit.
You want to try models without opening accounts. Opening five provider accounts to compare five models takes an afternoon of sign-ups and billing forms. One gateway account compares them by changing a string. That matters most early on, which is why LLM API for startups frames provider choice as an exit-cost question.
You want a smaller blast radius per leaked key. A provider key in ten services is ten places to leak one key that can spend your whole account. Gateway keys can be scoped: a spend limit, a model allowlist, an IP allowlist, an expiry. If one leaks, the damage stops at that key’s limit. See what to do in the first hour after a leak.
You want a free lane to prototype on. Several providers publish free tiers with different limits, and we compared them in free LLM API with no credit card. One account with 48 free ids behind it means you can compare models before you spend anything.
How the two routes compare, row by row
The table lists what differs on 28 November 2026. Where a row rests on a provider’s page, the source is linked in the last column. Where it rests on our own behaviour, the source is our documentation, and we say so because we are the publisher.
| Question | Direct API | Gateway (hosted router) | Source |
|---|---|---|---|
| Keys to manage | One per provider | One for all models behind it | Our authentication docs |
| Providers’ newest features | Available first | Available after the gateway adds support | Anthropic’s compatibility note on what a translation layer drops |
| Failover to another provider | You write it | Built in on most routers, rules differ | OpenRouter fallbacks, our routing docs |
| Rate limits | Yours, set per organization and tier | Set by the gateway; ask how they map to the provider’s limits | Anthropic limits, OpenAI limits guide |
| Fees on top of tokens | None from the provider | None to a percentage, depends on the gateway | OpenRouter pricing, fee comparison |
| Credits and expiry | Provider’s own terms | Gateway’s terms; OpenRouter reserves the right to expire unused credits after one year | OpenRouter FAQ |
| Parties who see the request | You and the provider | You, the gateway and the provider | Routing and privacy |
| Per-key budgets | Limited to org or workspace | Per key, on gateways that offer it | Cost control |
| One extra network hop | No | Yes | Measure it with the script below |
| Format conversion | None for the native API | Possible, check the features you use | Anthropic compatibility limits |
Two rows decide most real cases. Failover and per-key budgets are work you would otherwise write and maintain. Features and parties are costs that only you can price. Everything else is a tie-breaker.
What does the break-even look like with real numbers?
A gateway that charges a percentage and a direct setup that costs engineering hours scale in opposite directions. The fee grows with spend. The hours do not. That crossing point is the useful number, and it is easy to compute.
Take the fee OpenRouter publishes: 5.5 percent on credit purchases on the Standard plan, read on 28 November 2026. It is charged when you buy credits, not on individual requests. Now take an assumption that is ours and that you should replace: keeping direct access healthy costs 2 hours a month per provider (watching deprecations, rotating keys, reading limit changes, updating SDKs), valued at $100 an hour. The arithmetic follows.
| Monthly model spend | Gateway fee at 5.5% | Upkeep, 1 provider | Upkeep, 3 providers |
|---|---|---|---|
| $500 | $27.50 | $200 | $600 |
| $2,000 | $110.00 | $200 | $600 |
| $10,909 | $600.00 | $200 | $600 |
| $20,000 | $1,100.00 | $200 | $600 |
The break-even spend is upkeep divided by the fee rate: $200 / 0.055 = $3,636 a month for one provider, and $600 / 0.055 = $10,909 for three. Below those figures the percentage fee costs less than the hours. Above them, going direct is cheaper on money alone. That says nothing about failover, which a direct setup does not give you unless you build it, or about data rules, which can decide the question before any arithmetic starts.
Monthly cost at $2,000 spend, and at $20,000
- Gateway fee, $2,000 spend$1105.5% of $2,000
- Direct upkeep, 1 provider$2002 hours at $100
- Direct upkeep, 3 providers$6006 hours at $100
- Gateway fee, $20,000 spend$1,1005.5% of $20,000
Now edit the assumptions. Set the fee to 0 if your gateway adds nothing on top of token prices, or to the fee your own rival quotes.
Gateway fee against direct upkeep
- Gateway fee per month
- $110.00
- Direct upkeep per month
- $600.00
- Break-even monthly spend
- $10,909.09
- Shows $0.00 when the fee is 0, because the fee never catches up.
- On these numbers
- The fee costs less than the upkeep
Money only. Failover, per-key budgets, data rules and latency are not in this check. It runs in your browser and sends nothing.
Two cautions on reading it. First, if your gateway adds no percentage, the answer is always “gateway costs less”, and the question becomes one of trust and features. Second, your real upkeep hours may be zero for a stable single-provider setup, and then direct wins on cost at any spend. Be honest with the hours figure: we would rather you find direct is the right choice than start with us for the wrong reason. If you want the same exercise for token prices rather than fees, the cost calculator and the guide to reducing LLM API costs do that.
How does a gateway call work, so you can judge the hop?
A hosted gateway does five things to a request, and each one is either a cost or a benefit depending on what you need. This is how ours does it, from the routing and privacy documentation.
What a gateway call goes through
Read it as a ledger. Step 2 is where a per-key spend limit stops a runaway loop, with a 403 and nothing billed. Step 4 is failover: when the provider fails before sending any part of the answer (a 429, a 5xx or an unavailable model), the gateway retries the model you named up to twice, then tries up to three fallback models you listed in an X-Fallback-Models header, or a fallback you set in the console. A reply from a fallback model carries X-Fallback-From, so you can see it happened. An error that arrives after the answer started streaming is passed on as it is, which is the same limit the official SDKs have: the OpenAI Python SDK documents that stream consumption is not automatically retried, because replaying a request could duplicate output already delivered. Step 5 is the usage record: model, token counts, charge, time. Prompts and answers are not stored, only counts are kept.
What the diagram does not show is the cost. Each step is code that runs on our side and a place a request can wait. That is the hop.
What do you give up with a gateway?
Four costs, and we would rather list them than have you find them.
One more party in the path. Your request now passes through a company other than the one training the model. That is the same risk class as any third-party API, and it is why the first thing to ask any gateway is what it stores. Our answer is in the data-processing questions and the transparency page, which separates what we monitor from what we cannot see. The company running the model still receives your request, so a gateway never removes that party. It adds one.
Trust you have to verify, not feel. Third-party access to premium models is a market with bad actors in it. The CISPA study “Real Money, Fake Models” audited three shadow APIs, which it defines as third-party services claiming to provide access to official model services through indirect access. It reports performance divergence of up to 47.21 percent and identity-verification failures in 45.83 percent of fingerprint tests, and says that 4 of the 17 providers it identified had already ceased operations. Those findings are about services that claim to be an official model while serving something else. A gateway that bills per token and states which provider answers is a different thing, but a reader cannot tell the two apart from a landing page. Which is why the next section is a test, and why our plain-language summary of the study and cheap reseller risks exist.
Fees and credit terms. Some gateways take a percentage when you buy credit; OpenRouter’s pricing page lists 5.5 percent on Standard and 8 percent on Business, with token prices at the provider’s list price. Its FAQ says it reserves the right to expire unused credits after one year of purchase. Neither is hidden, and both belong in your arithmetic. For prepaid balances in general, read the prepaid credit guide before you top up anywhere, ours included. On the ownership of a rival you might be about to adopt, OpenRouter joining Stripe lists what to watch.
Lag on new features. A gateway supports a provider’s new capability after the provider ships it and the gateway’s engineers wire it up. For text chat the lag rarely matters. For a brand-new tool type or modality it can.
Add a fifth if you self-host: supply-chain exposure. LiteLLM’s own security update says two compromised PyPI packages, litellm==1.82.7 and litellm==1.82.8, were live on March 24, 2026 from 10:39 UTC for about 40 minutes before PyPI quarantined them, that customers running the official Docker proxy image were not affected, and that releases were paused until a broader supply-chain review finished. Read the incident page for its account. We cite it as a fact about running your own proxy, not as a verdict on a project that disclosed it openly: self-hosting makes you the person who reads advisories. The cost of that chore is a line in the upkeep hours above.
How do you test a gateway against going direct?
Run two tests before you route real traffic. Neither needs a card on ours, and both are cheap on any gateway.
Test one: the extra hop. The script below sends the same short prompt to your direct provider and to the gateway, with retries off so a retry cannot hide a slow call, and prints median and slowest time and the tokens billed per call. Set the environment variables, run it, and compare. If the two models differ you are comparing models, so use the same model on both routes when you can.
import os
import statistics
import time
from openai import OpenAI
# Same prompt, same output cap, both routes. Use the SAME model on both sides when you can,
# otherwise you are timing two models instead of one extra hop.
TARGETS = {
"direct": {
"base_url": os.environ["DIRECT_BASE_URL"],
"key": os.environ["DIRECT_API_KEY"],
"model": os.environ["DIRECT_MODEL"],
},
"gateway": {
"base_url": "https://api.oneaiapikey.com/v1",
"key": os.environ["ONEAIAPIKEY_API_KEY"],
"model": os.environ.get("GATEWAY_MODEL", "z-ai-glm-5.3:free"),
},
}
RUNS = 10 # on the free lane this spends 10 of the daily requests
PROMPT = "Reply with the single word: ok"
for name, t in TARGETS.items():
client = OpenAI(base_url=t["base_url"], api_key=t["key"], max_retries=0)
seconds, billed = [], []
for _ in range(RUNS):
start = time.perf_counter()
r = client.chat.completions.create(
model=t["model"],
max_tokens=16,
messages=[{"role": "user", "content": PROMPT}],
)
seconds.append(time.perf_counter() - start)
billed.append(r.usage.total_tokens)
seconds.sort()
print(
name,
"median", round(statistics.median(seconds), 3), "s",
"slowest", round(seconds[-1], 3), "s",
"tokens per call", sorted(set(billed)),
)Test two: the bill. The token count each route reports for the same prompt should be close. A large gap means one side is adding overhead, and the token billing audit shows how to count with a tokenizer yourself and what extra tokens are legitimate (system prompts, tool schemas, caching). The wider protocol, covering model identity, streaming, tool calls, errors and a support reply, is in how to test an LLM gateway for free, and verifying that an API serves the model it names covers identity checks.
On ours, the free path to run both tests is short. Sign in with Google on the sign-up page, create a key under Keys, and call a free id. The 48 ids ending in :free share 100 requests and 3,000,000 tokens a day per account, and they work with a $0 balance. The quickstart has the first call, and the free models list has the ids. Ten runs of the probe spend 10 of those 100 requests, and the usage page shows the records so you can compare them with your own count.
Can you use both routes at once?
Yes, and for many teams this is the right answer. Keep the provider you already trust as the primary route and keep a gateway key as the second route. Both speak the same SDK, so the switch is a base URL and a key. The snippet below retries the direct call once, then moves to the gateway on a 429, a 5xx or a connection error, and re-raises a 400 or 401 because a second route will not fix your bug.
import os
from openai import OpenAI, APIStatusError, APIConnectionError
# Primary: straight to the provider you already use. Fallback: the gateway, same SDK, other base URL.
direct = OpenAI(
base_url=os.environ["DIRECT_BASE_URL"],
api_key=os.environ["DIRECT_API_KEY"],
max_retries=1,
timeout=30,
)
gateway = OpenAI(
base_url="https://api.oneaiapikey.com/v1",
api_key=os.environ["ONEAIAPIKEY_API_KEY"],
max_retries=1,
timeout=30,
)
def ask(messages, direct_model, fallback_model):
try:
return direct.chat.completions.create(model=direct_model, messages=messages, max_tokens=300)
except (APIStatusError, APIConnectionError) as err:
status = getattr(err, "status_code", None)
if status is not None and status < 500 and status != 429:
raise # a 400 or 401 is your bug, a second route will not fix it
return gateway.chat.completions.create(model=fallback_model, messages=messages, max_tokens=300)Two details matter. Use a different model id on the fallback route if the gateway names models differently; the model pages list the exact ids. And set a timeout on the primary, or a hung connection never reaches the second route. The rate-limit documentation shows how to tune SDK retries, and handling 429 errors separates the three causes of that status.
This pattern also contains your exit risk. If the gateway disappears, your primary route is untouched. If the provider has an outage, the gateway carries the load. That is a cheaper insurance policy than most, and the vendor lock-in exit plan shows how to keep model ids in configuration so the switch is a config edit.
Which route fits you? A decision flow
Ask the questions in order. The first yes decides.
Ask in this order, first yes wins
Then pick your situation below for the specific next move.
Which describes you?
Solo builder, one model
Small team, two or three providers
Coding agent or loop-heavy workload
Regulated or contract-bound data
High spend, one or two providers
Where does One AI API Key fit?
We run a hosted gateway, so read this section as the pitch it is. We think we fit a specific reader and not every reader.
Who it fits. People who want to try or compare models without opening provider accounts, people who need per-key spend limits and a model allowlist, and people who want a free lane to prototype on. The gateway speaks the OpenAI format at {OPENAI_BASE} and the Anthropic Messages format on the same host, so existing SDKs only need a base URL and a key.
What is true today, and checkable without trusting us. Sign-in is Google only and there is no card field. A new account gets a $10 sign-up credit toward priced models, and the 48 free ids work immediately and keep working at a $0 balance, within 100 requests and 3,000,000 tokens a day per account, refilling at 00:00 UTC. Paid access beyond the credit is set up by email: write to somdutt777@gmail.com, and the pricing page shows the steps. Online checkout is not open yet. On the day you read this, check the models page for which priced ids are marked available, because the free ids are what answers today.
What you can verify yourself. Prices are published per million tokens on the models page and each model page shows the id. Status shows what the gateway measured. Rankings shows usage by model. The transparency page says what we monitor and what we cannot see. Every request leaves a usage record you can export, so you can compare our bill with your own token count, as the audit post shows. The acceptable use policy applies to every request.
What we are not. We are not the right route if your contract names specific processors, if you need a provider’s newest feature on release day, or if you spend enough that a fee passes your upkeep cost. In those cases go direct, and keep a gateway key as the second route if it helps. For how we compare with named rivals, the OpenRouter comparison is dated and sourced, OpenRouter vs One AI API Key is the longer honest version, and the nine-option LLM gateway comparison for 2026 lines up nine options on stated criteria. If you came for the other options, OpenRouter alternatives, Portkey alternatives and Vercel AI Gateway alternatives cover them, and the one-key trade-offs are in unified LLM API, one key for every model.
Why is paid access handled by email rather than a checkout button? That is its own post: buying LLM API access by email explains what it costs you in speed and what it buys in prices up front.
Score your own case
Tick every statement that is true for you today. The score is a rough guide, not a verdict: it counts reasons a gateway earns its place.
Does a gateway earn its place for you?
0 of 8 reasons
Go direct
You have few reasons for a middleman. Keep the base URL in an environment variable so you can add one later.
What would we check before trusting any gateway?
The same short list we apply to ourselves.
- Does it pass the free test? Identity, token counts and billing movement, run with the probe script and the verification checks, on a free or $1 budget.
- Can you read the bill? Every request should leave a record with model, tokens and charge that you can export and recount. See the billing documentation.
- Does it say what it stores? A clear statement, in writing, with the exceptions listed. Ours is in the routing and privacy docs, and LLM API privacy explains how to read such a page.
- What happens when something fails? Retries, fallbacks and error codes should be documented, with the error reference at errors.
- Who owns it and what happens to your credit? Read the terms for expiry, and for what the owner can change. The prepaid credits guide shows the questions.
- Is there a way out? Standard SDKs and a base URL in config mean you can leave in an afternoon. The choose a provider checklist is the full 12-point version.
None of these checks needs us to be honest in order to work, which is the point of them. Run them against us first if you like.
Run the two tests on the free lane first
$10 sign-up credit, 48 free models sharing 100 requests and 3,000,000 tokens a day, no card.