Skip to content

Self-hosted LLM gateways compared: limits, fallbacks and logs

How Kaeso, LiteLLM, Bifrost, Portkey and Helicone compare on spend limits, model fallbacks, provider key pools and request logging, with the measured throughput cost of logging.

Published
Reading time
4 min
Author
Kaeso Team
A deep gradient of deep and pale blue, in upright folds like a curtain, with a warm light in one corner

Most self-hosted LLM gateways claim spend limits, fallbacks and request logging on their feature lists. In production, the differences lie in three engineering details: whether a budget actually stops concurrent overruns, whether fallbacks and key rotation break prompt caches, and how much throughput request logging costs on the hot path.

This guide compares Kaeso 0.7.0, LiteLLM, Bifrost, Portkey Gateway and Helicone across those three operational pillars, grounded in each project's architecture and our published ai-gateway-bench results.

Feature comparison: limits, fallbacks and logging

  • Hard spend budgets
    Kaeso 0.7.0
    Atomic worst-case reservation in Valkey before upstream call
    LiteLLM
    Post-response database accounting + virtual key budgets
    Bifrost 2.6.0
    Virtual key hierarchical budgets
    Portkey Gateway
    Workspace budgets (advanced controls in Pro/Enterprise)
    Helicone
    Cost tracking and rate limits
  • Nested limit hierarchy
    Kaeso 0.7.0
    Project › Member/Service account › Key (strict nesting)
    LiteLLM
    Organization › Team › User › Virtual key
    Bifrost 2.6.0
    Customer › Team › Virtual key
    Portkey Gateway
    Workspace › Virtual key
    Helicone
    Organization / property filters
  • Fallback routing
    Kaeso 0.7.0
    Visual & API alias routes (by error kind, headers, tokens, splits)
    LiteLLM
    YAML fallbacks and context_window_fallbacks
    Bifrost 2.6.0
    Failover chains and load balancing
    Portkey Gateway
    Config-driven fallback chains and load balancing
    Helicone
    Proxy retries and provider fallbacks
  • Multi-key prompt cache stickiness
    Kaeso 0.7.0
    Weighted sticky draw per caller in Valkey across replicas
    LiteLLM
    Router load balancing strategies
    Bifrost 2.6.0
    Key pool balancing
    Portkey Gateway
    Weighted routing configs
    Helicone
    Provider key routing
  • Request log store
    Kaeso 0.7.0
    Self-hosted ClickHouse (optional, off per org/project)
    LiteLLM
    PostgreSQL + external callbacks (Langfuse, S3, Datadog)
    Bifrost 2.6.0
    Built-in logs + Prometheus / OTEL
    Portkey Gateway
    Local logs in core; full store in hosted platform
    Helicone
    ClickHouse observability-first store
  • Measured throughput (2 cores, 64 clients)
    Kaeso 0.7.0
    6,338 req/s (5,324 logs on)
    LiteLLM
    74 req/s Python / 3,211 req/s Rust (no logs)
    Bifrost 2.6.0
    2,806 req/s (no logs)
    Portkey Gateway
    779 req/s (no logs)
    Helicone
    Not in BerriAI's local lane

1. Spend limits and hard budgets

A spend limit that checks finished rows in PostgreSQL cannot enforce a hard cap under concurrency: an agent loop or batch job firing twenty parallel streams will pass the check twenty times before the first token finishes billing.

  • Kaeso checks every limit that applies (project, member or service account, and API key) in one atomic step in Valkey before calling the provider. For a hard spend budget, Kaeso reserves the request's worst-case cost (input tokens plus maximum output at the model's exact pricing tier, in exact decimal USD) and reconciles the real cost when the reply ends. Soft budgets allow traffic through and trigger alerts at 50%, 80% and 100% (plus signed webhooks). Each organization can view budgets and analytics in its own currency at daily ECB rates (Hard budgets, limits and currencies).
  • LiteLLM supports rich virtual keys (max_budget, budget_duration, rpm_limit, tpm_limit) and budget-based model fallbacks, making it flexible for teams already using PostgreSQL and Redis, though spend updates occur asynchronously after responses complete.
  • Bifrost provides hierarchical budgets across keys and teams with fast Go middleware, while Portkey reserves full multi-tenant budget governance for its commercial tiers.

2. Model fallbacks, retries and provider key pools

Reliable failover has two layers: failing over between keys of the same provider without breaking prompt caching, and falling back to another model when a provider is down or overloaded.

  • Kaeso handles both layers explicitly:
    • Weighted provider key pools. Assign several keys of the same provider (for example two Azure regions or primary and overflow Anthropic accounts) to one project with weights from 1 to 100. Every gateway replica pins a caller to the same provider key so Anthropic and OpenAI prompt caches stay warm; if a key is rate-limited or refused, Kaeso fails over to the next healthy key and places the failed key on a shared Valkey cooldown (Provider key pools).
    • Alias routes. An alias holds an ordered route: fallbacks triggered selectively by unavailable, limited, unsupported or rejected, conditions on prompt size or headers (sending long prompts directly to a larger-context model instead of failing first), and weighted A/B splits. Every response includes a kaeso-route header tracing every step tried, and retries run only where you explicitly enable them (Retries and fallbacks).
  • LiteLLM, Bifrost and Portkey all offer mature fallback chains and retries. Bifrost and Portkey also ship built-in semantic caching, whereas Kaeso ships an exact post-translation response cache in Valkey (no semantic cache).

3. Request logging and its real performance cost

Logging every prompt, tool call and reply is easy at 5 requests a second and expensive at 5,000.

In Kaeso, request logs write asynchronously in memory batches to ClickHouse after the response streams out, so logging never blocks time to first token. You control privacy and storage separately:

  • Metadata vs content retention. Defaults are 90 days for metadata (model, status, tokens, cost, timing, caller) and 30 days for prompt/reply content, configurable per organization.
  • Content logging off. Disable prompt and reply body logging at the organization or project level while keeping exact token counts, spend totals, budgets and analytics in PostgreSQL.
  • Media opt-in. Images, audio and files are logged only as type and byte size unless both organization and project opt into keeping media (capped at 10 MiB per request).
  • Measured overhead. On kaeso.app/benchmarks, turning full ClickHouse request logging on reduced Kaeso's two-core capacity by 16%, from 6,338 req/s to 5,324 req/s, while added latency at 16 clients stayed nearly unchanged (+0.62 ms p50 / +1.45 ms p99 vs +0.54 / +1.47 ms). Even with full request logging on, Kaeso served more requests per second than LiteLLM Rust (3,211 req/s), Bifrost (2,806 req/s), Portkey (779 req/s) and LiteLLM Python (74 req/s) with their logging off.

If your primary requirement is forwarding traces into existing third-party observability platforms such as Langfuse or Datadog, LiteLLM's callback ecosystem or Helicone's observability tooling fits that workflow directly. If you want self-contained request logs, cost analytics and CSV/JSONL exports on your own infrastructure with measured low overhead, Kaeso includes the full stack out of the box (Request logs and privacy).

See the full side-by-side matrix on /compare.

Product names in this article belong to their owners and are used only to name the software and services involved. Kaeso is not affiliated with or endorsed by them.

By Kaeso Team

On this page

Own the gateway.Own the record.

curl -fsSLhttps://kaeso.app/install.sh | sh