AI Blog

LiteLLM vs Portkey vs Helicone vs OpenRouter: in the path, or beside it

Two binary questions decide this and no feature list does: is the gateway inside the request path, and who holds the provider credential. Everything a gateway does that changes a request — caching, fallback, rate limiting, key rotation — requires the first, and everything about your blast radius and your bill follows from the second. For agents both answers get multiplied by step count, which is why a choice that is merely fine for a chat app can be structurally wrong for a loop.

By Agentic AI Wiki 12 min read

Every gateway comparison you will read is a feature table, and the feature tables are nearly interchangeable because the products converged years ago. Two binary questions decide this instead: is the gateway inside the request path, and who holds the provider credential. The first sets a hard ceiling on what any of them can do for you — nothing that changes a request is possible from beside the path — and the second decides what happens on the day the gateway is down. For an agent, both answers get multiplied by step count, which is how a choice that is merely fine for a chat app becomes structurally wrong for a loop.

At a glance

Four products that occupy genuinely different positions, described the way their own documentation describes them.

ProductShapeHolds your provider key?Entry terms
LiteLLMOpen-source proxy you run; one OpenAI-compatible API over 100+ modelsNo — you doFree to self-host; paid enterprise tier
PortkeyProduction control plane; managed or self-hostedNo — you doFree tier around 10,000 logs/month
HeliconeObservability-first; explicit choice of proxy or off-path async loggingNo — you doFree tier around 10,000 requests/month
OpenRouterManaged marketplace; one key, 200+ models, their routingYes, unless you use BYOK5.5% fee on credit-card top-ups (5% crypto), $0.80 minimum per transaction
Where each gateway leans hardest Four rows by four columns. LiteLLM is strong on self-hosting and provider breadth, medium on in-path control, weak on managed operations. Portkey is strong on in-path control and managed operations, medium on self-hosting and provider breadth. Helicone is strong on observability depth and offers a deliberate off-path mode, medium on in-path control and self-hosting. OpenRouter is strong on provider breadth and managed operations, weak on self-hosting and on holding your own credential. Where each one leans hardest Self-host it In-path control Provider breadth Zero-ops LiteLLM Strong Medium Strong Weak Portkey Medium Strong Medium Strong Helicone Medium Optional Medium Strong OpenRouter Weak Medium Strong Strong Strong Medium / optional Weak or not offered "Optional" marks Helicone's documented choice between a proxy and off-path async logging.
Four different bets, not four rankings of the same bet.

OpenRouter's fee structure deserves one line of clarification because it is routinely misdescribed: it does not mark up provider token rates. What it charges is a fee on money entering the system — 5.5% on card top-ups, 5% on crypto, with a floor of $0.80 per transaction — plus a 5% fee on bring-your-own-key traffic above a monthly free allowance that recent write-ups put at either the first million BYOK requests or roughly $25,000 of list-price inference, rising substantially on enterprise plans. Check the current terms before you model it; the structure is stable, the thresholds move.

Question one: in the path, or beside it

A gateway in the request path compared with one beside it Top: the in-path deployment sends the agent's call through the gateway to the provider, so the gateway can cache, fall back, rate limit and rotate keys, but it is also a dependency whose outage stops the agent. Bottom: the beside-the-path deployment calls the provider directly and ships a copy of the exchange to the observability service afterwards, so an outage costs only telemetry, but nothing can be changed in flight. In the path — proxy Agent loop Gateway Model provider Can change the request in flight: semantic and exact caching · retry and provider fallback · rate limits and spend caps · key issuance and rotation · guardrails and redaction · routing. Costs: one more hop on every step, and an availability dependency — if it is down, the agent is down unless you coded the bypass yourself. Beside the path — async logging Agent loop Model provider Observability service copy of the exchange, after the fact Outage costs telemetry only. Nothing can be changed in flight.
Helicone documents this as a choice you make. It is the most useful framing in the category.

Helicone's own docs put the two integrations side by side — proxy versus async — and state the trade honestly: async keeps the logging off the critical path, so an outage or a network problem at the vendor cannot affect your application, but async "cannot offer the same suite of tools as the proxy", because the proxy is what sits on the edge and gatekeeps the request. Caching, rate limiting, API-key management, threat detection and moderation all live on the proxy side of that line.

That framing generalises to all four products and it is worth stating as a rule: anything that changes a request requires being in the request path, and everything in the request path is a dependency you have to survive. There is no configuration that gets you both. Teams discover this the hard way when they buy a gateway for its observability, deploy it as a proxy because that is the quick-start path, and thereby put a startup's uptime in front of every model call they make.

Which side you want depends on what you are actually buying:

  • Buying visibility? Go off-path. Traces, cost attribution and latency histograms all work fine from an async logger, and you keep a failure domain you already understand. See tracing & observability.
  • Buying control? You are in the path, so budget for it: health checks, a documented bypass, and a tested answer to "the gateway is returning 503, what happens to running agents". Graceful degradation is the page to read before, not after.
  • Buying both? Run the proxy, but make the bypass a first-class code path that you exercise on a schedule rather than a comment in the runbook.

Question two: who holds the provider credential

Three answers to who holds the provider credential Three columns. You hold it, on a gateway you run: the provider account and rate limits are yours, and prompts stay inside your perimeter. You hold it, on a managed gateway using bring-your-own-key: the account is yours but the traffic and often a fee pass through the vendor. The gateway holds it: you buy credits, the vendor owns the provider relationship, and your fallback when it is down is an account you do not have. Who holds the provider credential You, on your own gateway LiteLLM, Helicone or Portkey, self-hosted. Provider account and rate limits are yours. Prompts stay inside your perimeter. You operate it. You, via bring-your-own-key Managed control plane, your keys behind it. Account stays yours; traffic and often a fee pass through the vendor. Nothing to operate. The gateway holds it You buy credits; the vendor owns the provider relationship. Fastest to start, widest catalogue. Your fallback is an account you do not have. The column you pick decides your outage story before it decides anything about features.
This column choice decides your outage story before it decides anything about features.

The credential looks like a configuration detail and behaves like an architectural commitment. Whoever holds it owns the provider relationship: the rate limits, the quota increases, the abuse escalation, the enterprise agreement, and the ability to call the provider directly when the layer in between stops working.

Compare the three positions on the day something breaks. If you self-host LiteLLM or Portkey and your own gateway falls over, you point your SDK at the provider and lose your routing policy — an incident, not an outage. If you use a managed control plane with BYOK, the same is true with one more phone call. If you are on OpenRouter's credit model and OpenRouter is unavailable, your fallback is a provider account you do not have, with no quota history and no negotiated limits; opening one takes minutes for the signup and days for the rate limits to matter.

That is not an argument against OpenRouter, which is genuinely the fastest way to reach 200-plus models behind one key and the right answer for a large class of work. It is an argument for pricing the dependency honestly, and for keeping a dormant direct account on your two most important models if the agent is doing anything a business depends on.

The credential also decides where your prompts go. A self-hosted proxy keeps them inside your perimeter, which is the whole reason regulated teams reach for LiteLLM; a managed gateway sees them by construction. That is a data residency question, and it does not have a technical workaround — only a deployment choice.

The agent multiplier

Everything above applies to a chat application. Agents change the magnitudes, and in three places they change them enough to flip the decision.

Latency compounds, and the tail is what you feel

A chat turn is one model call, so an extra 30ms of proxy hop is invisible next to a two-second generation. A twenty-five step agent task pays it twenty-five times, and — more importantly — takes the gateway's p99 twenty-five times. If any single step failing kills the task, a 1% per-call failure rate gives you roughly a 22% task failure rate. Median latency is the number gateways advertise; tail behaviour under your own concurrency is the number that decides whether your agent finishes, and only a load test tells you it.

A percentage is a per-step tax

Fees that read as small on a per-request basis are levied per model call, not per user action. The relevant unit for an agent is cost per successfully completed task, and a task is dozens of calls. This is the same shape as the argument we made when Stripe bought the metering layer rather than the routing layer: whoever sits in the request path of an agent is charging per step of a loop whose step count you do not fully control.

Provider prompt caching is the one to guard

This is the trap that costs real money and generates no alert. Agents re-send a growing transcript on every step, so provider-side prompt caching is often the single largest lever on the bill — and it depends on an exactly stable prefix and correct cache-control handling. A gateway that normalises headers, reorders system content, injects its own preamble, or load-balances the same conversation across providers can silently reduce your cache hit rate. Nothing errors. The bill goes up by a multiple, attributed to "more usage".

Test it directly before you commit: run the same twenty-step task through the gateway and around it, and compare the cached-token counts the provider reports. If the gateway costs you cache hits, no amount of gateway-level caching makes that back.

When to pick which

SituationPickBecause
Prompts must not leave your perimeterLiteLLM, self-hostedOpen source, one OpenAI-compatible surface over 100+ models, and you hold every credential.
You want in-path control without running itPortkeyManaged control plane built for the proxy position: caching, guardrails, routing and governance in one place.
You want visibility and no new failure domainHelicone, async modeIt is the one product that documents the off-path option as a first-class integration rather than a fallback.
Breadth of catalogue, minimum setupOpenRouterOne key to 200+ models with no infrastructure; price the credit fee and the missing direct account as the cost.
Cost attribution across tenants and featuresAny of them, in pathThe gateway is the only place that sees every call; see cost attribution.

The combination worth naming explicitly, because it is what a lot of mature agent teams end up running: a self-hosted proxy for the production path, an async logger for the analytics that must not add a dependency, and a managed marketplace key kept for evaluation work where reaching a new model in five minutes is worth more than the fee.

FAQ

Does OpenRouter mark up token prices?

No. It charges a fee on credits entering the system — 5.5% on card payments, 5% on crypto, with an $0.80 per-transaction floor — and a 5% fee on bring-your-own-key traffic above a monthly free allowance. Provider token rates pass through.

Can I get caching and fallback without putting a gateway in my request path?

No. Both require the ability to change a request before it reaches the provider, which is only possible from inside the path. Off-path integrations can observe and cost-attribute; they cannot intervene.

Will a gateway break provider prompt caching?

It can, and it will not tell you. Anything that alters the stable prefix — header normalisation, injected system content, cross-provider load balancing of one conversation — reduces the hit rate. Measure cached-token counts through the gateway and around it before committing.

Is self-hosting LiteLLM actually free?

The software is. The operating cost is not: you are running a proxy on the critical path of every model call, which means capacity planning, upgrades, and an on-call rotation that now owns a new tier-one dependency.

Which one should a small team pick to start?

Start off-path with async logging so you learn your traffic without adding a dependency, and move into the path only when you have a concrete need — a fallback policy, a spend cap, a key-rotation requirement — that cannot be met from beside it.

Further reading

On this wiki:

Project sources: