LLM API Gateway Open Source Comparison: 2025 Guide
If you're searching for an "LLM API gateway open source comparison," you're probably trying to decide between self-hosting a proxy that routes requests across multiple model providers, or paying for a managed layer that does the same thing without the ops work. The short answer: open source gateways give you full control over routing, caching, and cost tracking, but you pay for that control in deployment time, scaling, and ongoing maintenance.
This article compares the main open source options on the market today — what each one actually does well, what it leaves to you, and when a managed alternative is the better call.
What an LLM API gateway actually does
Before comparing tools, it helps to define the job. A gateway sits between your application and one or more model providers (Anthropic, OpenAI, Mistral, local models, etc.) and typically handles:
- Unified request format — one API shape regardless of the underlying provider
- Routing and failover — send traffic to a backup provider if the primary is down or rate-limited
- Key management — centralize provider credentials instead of scattering them across services
- Rate limiting and quotas — per-app, per-user, or per-team limits
- Caching — avoid re-paying for identical prompts
- Observability — logs, token usage, latency, cost per request
Not every project needs all of this. If you only ever call one provider, a gateway mostly buys you observability and rate limiting. If you call several providers, routing and failover become the main value.
The main open source options
LiteLLM Proxy
LiteLLM is probably the most widely adopted option for teams that want a single OpenAI-compatible endpoint in front of 100+ providers. It runs as a lightweight proxy (Python, FastAPI-based), supports streaming, function/tool calling translation, budget tracking per API key, and a Postgres-backed admin UI for managing virtual keys.
Strengths: broad provider coverage, active community, easy to run as a Docker container. Trade-offs: you own the database, the uptime, and the upgrade cycle. Advanced features like SSO and detailed audit logs live behind a paid "Enterprise" tier even though the core proxy is MIT-licensed.
Portkey Gateway
Portkey's open source gateway focuses on reliability features — retries, fallbacks, load balancing across API keys, and semantic caching. It's a thin Node.js layer you can self-host, with a hosted version available if you don't want to run it yourself.
Strengths: good fallback/retry logic out of the box, simple config format. Trade-offs: the richer observability dashboard and guardrails are part of the hosted product, not the open source core.
Kong AI Gateway / Apache APISIX AI Gateway
Both are plugins on top of established API gateway platforms (Kong and APISIX) rather than purpose-built LLM tools. If you already run Kong or APISIX for your regular REST APIs, adding the AI plugin lets you reuse existing auth, rate limiting, and logging infrastructure.
Strengths: mature, battle-tested gateway cores; good for teams with existing API infrastructure. Trade-offs: more configuration surface, steeper learning curve if you're starting from zero, and LLM-specific features (token counting, streaming nuances) are newer and less polished than in purpose-built tools.
Helicone
Helicone is more observability-first than routing-first. You point your existing API calls through its proxy (or use its SDK wrapper) and get cost, latency, and prompt logging. It's open source and self-hostable, with a hosted tier for teams that don't want to manage the ingestion pipeline.
Strengths: best-in-class logging and cost breakdown per request. Trade-offs: lighter on multi-provider routing and failover compared to LiteLLM or Portkey.
What self-hosting actually costs you
Every option above is free to run in the sense that the code is open. What's not free:
- A server or container platform to run it on, with uptime monitoring
- A database for keys, usage logs, and budgets
- TLS certificates and domain setup
- Upgrade management as the project ships new releases
- On-call responsibility — if your gateway goes down, every app behind it goes down
For a side project or internal tool, this might be an afternoon of setup. For a production system serving customers, it's a recurring operational line item, usually underestimated at first.
A minimal LiteLLM config to route Claude calls looks like this:
model_list:
- model_name: claude-main
litellm_params:
model: anthropic/claude-3-5-sonnet-20241022
api_key: os.environ/ANTHROPIC_API_KEY
general_settings:
master_key: sk-local-admin
That's a reasonable starting point. The work shows up later, in monitoring, patching, and handling edge cases like partial streaming failures.
When a managed layer makes more sense
If your actual need is narrower than "gateway for every LLM provider" — specifically, "I need a clean, authenticated HTTPS API in front of Claude for my apps and team" — running a full gateway is often more infrastructure than the problem requires.
That's the gap SubToAPI fills. Instead of self-hosting a proxy, you get application-scoped keys (sub_live_...), streaming, tool use, and usage metadata through a hosted dashboard, with team seats for sharing access across a group without sharing one raw key. No server to run, no database to manage.
curl https://api.subtoapi.app/v1/messages \
-H "Authorization: Bearer $SUBTOAPI_KEY" \
-H "content-type: application/json" \
-d '{
"model": "claude-3-5-sonnet-20241022",
"max_tokens": 1024,
"messages": [{"role": "user", "content": "Summarize this changelog."}]
}'
This isn't a multi-provider gateway — it's purpose-built for Claude, which is a different trade-off than LiteLLM or Portkey. If you need routing across five providers, an open source gateway is the right tool. If you just need a solid, metered, team-friendly API for Claude without standing up your own infrastructure, start with the quickstart and check pricing.
How to choose
- Need multi-provider routing and failover today → LiteLLM or Portkey
- Already running Kong/APISIX for other APIs → Kong/APISIX AI plugin
- Mainly want cost and prompt observability → Helicone
- Mainly need Claude access with per-app keys, team seats, and no ops burden → a managed option like SubToAPI
Pick based on what you'll actually operate for the next year, not just what's easiest to demo this week.
questions
Is an open source LLM gateway free to run in production? The code is free, but you still pay for hosting, database, monitoring, and maintenance time. Budget for ongoing ops work, not just the initial setup.
Do I need a gateway if I only use one provider, like Claude? Not necessarily a full multi-provider gateway. You may just need per-app keys, rate limits, and usage tracking, which a focused hosted API layer can provide with less setup.
Which open source gateway has the best fallback/retry support? Portkey and LiteLLM both support retries and provider fallbacks out of the box; Kong and APISIX require more manual configuration to achieve similar behavior.