As teams scale their LLM usage, a new category of infrastructure is emerging: the LLM gateway. Search interest is spiking. Vendors are multiplying. But there's a lot of confusion about what a gateway actually does, when you need one, and what the cheaper alternatives are.
Let's break it down.
An LLM gateway is a proxy layer that sits between your application and one or more LLM APIs. It intercepts every request and can add functionality like:
Popular LLM gateways include LiteLLM, OpenRouter, Portkey, and Helicone. Each has different strengths and pricing models.
Gateways make the most sense when you have specific routing or reliability requirements:
If you don't have these requirements, a gateway adds infrastructure complexity without proportional benefit.
Most teams searching for LLM gateways are actually trying to solve three simpler problems:
A full gateway solves problem 3 well. But for problems 1 and 2 — which are what most teams actually care about day-to-day — a gateway is overkill.
Instead of routing all traffic through a proxy server, you can wrap your existing LLM client directly in your application code. No new infrastructure. No proxy latency. No single point of failure.
import { wrap } from 'tokoscope'
// Before: direct client
const client = new OpenAI()
// After: wrapped client — identical interface
const client = wrap(new OpenAI(), {
apiKey: 'ts_live_...'
})
// All your existing calls work unchanged
const res = await client.chat.completions.create({
model: 'gpt-4o',
messages: [{ role: 'user', content: 'Hello' }]
})
This gives you token tracking, cost attribution, semantic caching, and prompt compression — without the operational overhead of running a proxy.
| Requirement | Gateway | SDK wrapping |
|---|---|---|
| Token usage tracking | ✓ | ✓ |
| Semantic caching | Some | ✓ |
| Prompt compression | ✗ | ✓ |
| Multi-provider routing | ✓ | ✗ |
| Automatic failover | ✓ | ✗ |
| Infrastructure to manage | Yes | No |
| Proxy latency added | 20-100ms | 0ms |
| Setup time | Hours-days | 2 minutes |
OpenRouter is a popular gateway that provides a unified API for 100+ models. You send requests to OpenRouter's endpoint and it routes to the underlying provider. The appeal: one API key, access to every model.
The tradeoff: every request goes through OpenRouter's servers, adding latency and creating a dependency on their uptime. They also add a markup on top of provider pricing.
LiteLLM is an open-source gateway you self-host. It gives you multi-provider routing without the vendor dependency. The tradeoff: you're now running and maintaining a proxy server, which has real operational overhead.
LiteLLM is a good choice if you're already running Kubernetes and have DevOps capacity. For most early-stage teams, it's more infrastructure than the problem warrants.
LLM gateways are real infrastructure solving real problems — just not the problems most teams have on day one. Start with SDK wrapping for visibility and cost reduction. Add a gateway later if you genuinely need multi-provider routing or failover.
Build the simplest thing that solves the actual problem. Most teams searching for LLM gateways are really looking for cost visibility — which is a 2-minute SDK integration, not a proxy server.
Tokoscope wraps your existing OpenAI, Anthropic, or Gemini client. No proxy, no infrastructure, no latency.
Get started free →