I frequently have conversations around model security and AI Gateways so I wanted to understand what they do at the request level, and not just by skimming over the docs. The plan was to deploy each one in front of a small agent, run the same tests, and learn how they handle the things in production: overhead, failover, budgets, screening, identity and audit. The comparison was simply a by-product of the learning; the point was to get hands-on with each platform, and use the GUI too.
The lab ended up as three open-source gateways on GCP, each deployed one at a time on Cloud Run in front of the same ADK agent calling Gemini 3.8 Flash and Claude Haiku 5.5, and tested against a seven-test matrix with a Python load harness: LiteLLM v1.103.2, Bifrost v2.2.6 and Kong OSS 3.9.3. I opted for OSS editions only; no licence, trial or paid tier was used. Each was deployed, tested and then destroyed. The infrastructure is in Terraform (with documented steps for the gateway keys and Kong's config sync), and the full results (raw runs included) are in the public repo, with a setup guide if you want to run it in your own project.
What I found (in short)
Warm, without screening switched on, the gateways themselves added little (apart from a hop) which is what I'd expect. Kong's slower Gemini turns were spent upstream, most likely because Kong drops the thinking setting (which I'd set to Low). The real differences are in what each one's free edition will do for you, which again is somewhat expected. For this OSS matrix, LiteLLM's OSS edition has the most AI controls: failover, hard budgets, PII masking and an LLM judge for injections, though its OSS guardrails apply to every caller alike. Bifrost added no measurable overhead and has the fullest budgets on OSS, but screens nothing without a licence. Kong OSS is a solid proxy with a very good request log, but failover, token limits and PII detection are enterprise features. On all three, built-in binding to the caller's Google identity and an admin audit log are paid.
How it was set up
Each gateway ran on one Cloud Run instance (1 vCPU, max 1 instance) in europe-west1, with Cloud SQL Postgres for its state and secrets from Secret Manager. The agent's code didn't change between gateways; an environment variable simply pointed it at the current one. The models were called on the Agent Platform's eu multi-region endpoint. The architecture doc has the identities, network and Terraform layout.
A Python load harness ran as a Cloud Run job. Every overhead run paired the gateway with a direct-to-model baseline in the same job, because Gemini's latency drifts by seconds between runs: Claude's p50 moved by tens of milliseconds between two runs 1.5 hours apart, while Gemini's p95 moved by up to 11 seconds, in both directions. Paired baselines let each gateway's overhead be measured against its own baseline, not another day's.
The main overhead runs used fixed prompts and a 256-token cap, and asked for Gemini thinking at LOW and Claude thinking off. Ten warm-up requests were discarded per cell, and each cell had 100 requests per target in ABBA-ordered blocks of 25, re-warming between blocks. The shorter agent-path runs used 20 requests per target; the behaviour tests (2-6) ran from a workstation with their own settings.
The seven tests
| # | Test | What it measures |
|---|---|---|
| 1 | Overhead | Latency the gateway adds, against a paired direct baseline |
| 2 | Routing and failover | Can the gateway fail over from one model to the other? |
| 3 | Cost control | Budgets, rate limits, burst behaviour |
| 4 | Inline screening | PII masking and prompt-injection blocking, shared case set |
| 5 | Identity and secrets | Who reaches the gateway, how it authenticates to models |
| 6 | Audit fidelity | Can the logs reconstruct one agent run? |
| 7 | OSS ceiling | What needed the paid tier, and how it showed |
Overhead
Compare each gateway only within its own paired run; they ran on different days.
- LiteLLM: +20-30 ms at concurrency 1, +50-65 ms at 5 on Claude. The rise with concurrency fits the deployment: one instance with a single uvicorn worker. Gemini's differences were inside its own noise.
- Bifrost: indistinguishable from zero on Claude; it reports a median of 1.9 ms of its own. The gateway path even came out faster than direct in six of eight cells. A gateway can't make the model faster, so read the negative deltas as zero.
- Kong: its own processing was 1-3 ms. Claude went through as a native pass-through (+22 and +33 ms TTFT). Gemini was 0.7-1.0 s slower, and that time was spent upstream, not in Kong: most likely because Kong drops
reasoning_effort, so Gemini thinks at its default level instead of LOW (the run couldn't isolate how much of the delta that explains). Kong's Gemini streams also arrived in one burst rather than progressively.
Kong's Claude numbers aren't comparable with the others: Kong passed Claude's native Vertex format straight through, while LiteLLM and Bifrost translated from OpenAI format. Different work, different measurement.
Routing and failover
- LiteLLM: Gemini to Claude failover and back, streaming too, visible to the caller in the response's
modelfield and thex-litellm-attempted-fallbacksheader. A caller can opt out withdisable_fallbacks. - Bifrost: the same, visible in the response body (
is_fallbackin its routing info). Fallbacks can be set by a routing rule or by the caller sendingfallbackswith the request; a rule's fallbacks can't be opted out of. - Kong OSS: none. One model per route; failover is in AI Proxy Advanced, which is enterprise.
A gotcha on both LiteLLM and Bifrost: a fallback keeps the original request's parameters. A Claude request carries no reasoning_effort (thinking is off for Claude), so when it fails over to Gemini, Gemini thinks at its default level. In the recorded checks that was 58 reasoning tokens through LiteLLM and 137 through Bifrost; earlier, unsaved checks went up to 186, one leaving just 14 tokens of answer from the 256-token cap.
Cost control
- LiteLLM: hard budgets and rpm/tpm limits per key, enforced by reservation: each request reserves its worst case before the model is called, so a burst is refused early and spend ends at most one request over (0.3-8.5% in the test). The flip side is that it errs towards refusing: when a burst was refused, only about a quarter of the budget had actually been spent.
- Bifrost: hard budgets and rate limits per key, per provider and per model (per-model budgets on one key are enterprise in LiteLLM). No reservation, so bursts overshoot: 3.1× a budget with ten requests at once. A budget's real ceiling is the limit plus one burst.
- Kong OSS: request counts only, per consumer or per consumer and model, in fixed windows, counted in the instance's memory. Bursts can overshoot these too: in my notebook, nine of ten requests sent at once got through a limit of three. No token or money budget, and its logged Gemini cost leaves out thinking tokens.
Both LiteLLM's bundled price map and Bifrost's live price file had Gemini 3.8 Flash at half price when I checked, so I set prices by hand. A budget is only as correct as the price it uses.
Inline screening
The same 18-case set (PII in the prompt, prompt injection, PII the model is asked to write, benign near-misses) ran on both models through each gateway. In the control runs, through each gateway with screening off, neither model obeyed any injection, but they repeated most of the PII, so for these models the gateway's real job was PII, not injection.
- LiteLLM OSS: a built-in content filter masked PII both ways (UK mobile and NI numbers needed custom regexes), and an LLM judge blocked every injection, including the indirect and encoded ones. The judge typically added 3-4 seconds per request, but the PII cases took a 45-second median, with one timeout (the cause wasn't isolated). It fails open, and its cost is invisible to budgets and the spend ledger. These guardrails are global on OSS: choosing them per key is enterprise.
- Bifrost OSS: screens nothing. A
guardrails_configfollowing Bifrost's own documented example validated, deployed and did nothing, with no warning. Every guardrail is enterprise. - Kong OSS: a regex deny list (
ai-prompt-guard) blocked all 12 PII prompts and 10 of the 12 injections, but only because I wrote the patterns knowing the cases, and both base64-encoded injections still got through. It never sees the answer, so PII in the output got through, and it can refuse but not mask. An LLM rewrite of the request (ai-request-transformer) masked all six PII values on the Claude pass-through, but every Gemini answer came back in Vertex's native format, unreadable to an OpenAI client (non-streaming; streaming wasn't tested).
Identity and secrets
In all three, Cloud Run IAM decides who reaches the gateway at all; past that, the gateway knows a caller only by a bearer key. Built-in binding to the caller's Google identity (LiteLLM's JWT auth, Bifrost's SSO, Kong's OIDC plugin) is paid on all three, as is an admin audit log. Kong OSS does have a JWT plugin, but it checks tokens against keys set per consumer, not Google's; I didn't try it, or a custom mapping.
Three things surprised me. First, Kong forwards nearly every caller header to the model, the caller's ID token included: Cloud Run replaces its signature, so it can't be replayed, but its claims travel. Bifrost only forwards headers on an allowlist (from its source; none was configured), and I didn't test LiteLLM's upstream headers. Second, LiteLLM's error for an unknown key echoed the key's last four characters and its SHA-256 hash; Bifrost's errors gave nothing away. Third, Bifrost has key rotation in OSS (one operation, the old value refused at once); in LiteLLM the regenerate endpoint is enterprise, so on OSS you rotate by hand.
Audit fidelity
LiteLLM and Kong logged a row for every request that reached them, refusals included; Bifrost logged every request that reached a model and its own budget and access refusals, but a request it couldn't route left no row. None of them joins the agent's hop to its gateway row except by key and time: the agent sends no session ID or tag. The fix is on the caller's side and needs no gateway change. Kong's log was the easiest to work with: it keeps the request headers, so every row joins Cloud Run's own request log exactly by trace ID, where Bifrost's joined by time only.
Two settings store credentials. LiteLLM's store_prompts_in_spend_logs keeps the caller's ID token alongside the prompts, so anyone who can read the spend log can collect tokens usable against the gateway for up to an hour. Bifrost's logging_headers can store keys and ID tokens. Both are off by default, but Bifrost does store prompts and answers by default, for 365 days.
The OSS ceiling
This is where the three gateways differ most, and where ranking them would be wrong, because the right choice depends on what you need from OSS.
| Capability | LiteLLM OSS | Bifrost OSS | Kong OSS |
|---|---|---|---|
| Failover | yes | yes | enterprise |
| Money budgets | yes (reservation) | yes (no reservation) | no |
| Per-model budgets | enterprise | yes | no (request limits per model) |
| PII masking | yes | enterprise | partial (LLM rewrite, Claude route only) |
| Injection screening | yes (LLM judge, keyword filter) | enterprise | partial (regex deny list) |
| Key rotation | manual (regenerate is enterprise) | yes | manual |
| Built-in Google identity binding | enterprise | enterprise | enterprise |
| Admin audit log | enterprise | enterprise | enterprise |
In short
- LiteLLM has the most AI controls on OSS (failover, budgets, PII masking, an LLM judge) and charges for governance across many callers: per-key policy, identity, the admin audit log.
- Bifrost added no measurable overhead and has the fullest budgets on OSS, per model included, plus key rotation. It has no screening at all on OSS, and its paid gates are silent.
- Kong OSS is a mature proxy with AI translation, a complete, joinable request log and flexible plugin scoping. Its AI controls (failover, token limits, PII detection) are enterprise.
What this doesn't cover
One instance per gateway, so no multi-instance counters, high availability or sustained load. Two models on one platform. Agent-to-model traffic only; no MCP, A2A or ingress patterns. No paid edition was tested, so what the paid tiers do comes from source and vendor docs, not measurement. The full scope and caveats are in the repo's takeaways.
The source code, the Terraform, the retained raw runs (with credentials redacted) and the full test-by-test breakdown are on GitHub.