Direct LLM API vs LLM Gateway: Portkey vs Kong AI Gateway vs LiteLLM vs Custom
Direct provider APIs are the fastest way to prototype, but across many apps and teams they leave cost tracking, policy and failover scattered. LLM gateways sit between your apps and providers, offering unified auth, cost attribution, rate limits, retries, and observability — at the cost of an extra hop and dependency.
Last reviewed:
What we're comparing
- Direct provider APIs
Applications call Anthropic / OpenAI / Google SDKs directly. Simplest architecture.
- LLM gateway
Middleware layer between applications and providers. Handles auth, rate limiting, cost attribution, retries, routing, observability. Examples: Portkey (now part of Palo Alto Networks' Prisma AIRS), Kong AI Gateway, LiteLLM, Cloudflare AI Gateway, custom.
Side-by-side
| Attribute | Direct provider APIs | LLM gateway |
|---|---|---|
| Setup time | Minutes | Longer: deploy or configure the gateway, keys and policies |
| Cost attribution | App-by-app (each pays separately) | Per-team / per-user / per-project centrally |
| Retry / fallback logic | Per-app implementation | Centralized with configurable policy |
| Provider fallback | App-side switching required | Fall back automatically if provider unavailable |
| Model routing | Per-app rules | Centralized routing policy across all apps |
| Observability | Per-app instrumentation | Unified dashboard for all LLM traffic |
| Rate limiting per tenant | App-implemented (often skipped) | Native, enforced centrally |
| Best for | Prototypes, single-app deployments, MVP | Several production apps, multi-team GenAI programs, cost governance at scale |
When to use which
- Use Direct provider APIs
You are in early prototype phase or running a single application. The gateway overhead is not yet justified.
- Use LLM gateway
You run several production apps, cross-team cost attribution is required, provider failover is a business requirement, or you want a single place to enforce policy.
FAQs
Portkey vs LiteLLM vs Kong AI Gateway — how to choose?
Portkey: managed control plane with a hybrid option (gateway in your network), strong observability and guardrails; Palo Alto Networks acquired it in 2026 and is folding it into Prisma AIRS, so expect a security-led roadmap. LiteLLM: open-source (MIT), self-hosted OpenAI-compatible proxy with per-key/team budgets, rate limits and fallbacks; easy to extend. Kong AI Gateway: API-management heritage, Konnect-managed or self-hosted; best if you already run Kong. Cloudflare AI Gateway: analytics, caching, rate limiting and fallbacks; fits if you already use Cloudflare.
What is the latency overhead?
An extra network hop plus whatever processing you enable (logging, guardrails, caching). It is usually small next to model response time, but measure it on your own deployment. For tight budgets such as voice, run the gateway close to your app and the provider region.
Can we build our own gateway?
Yes but consider the roadmap. A basic proxy is quick to build; maintaining it (adding new providers, keeping SDK adapters current, adding features that vendors add regularly) is ongoing work for a team. Buy for stable production; build if the LLM stack is your core product.
Get updates when this comparison changes
We re-review comparisons as tools and pricing move. One practical GenAI note per month, plus alerts on material changes. Unsubscribe anytime.