LiteLLM vs Portkey: when to use one over the other
Jon Gitlin
Senior Content Marketing Manager
at Merge
As you build products that use LLMs, you’ll need routing logic that sends every request to the best-fit model based on your goals (cost, response time, or reliability).
But building this logic in house can be incredibly time and resource intensive. Your gateway will be a tier-0 service your team needs to maintain and troubleshoot as providers change and fail.
With that in mind, you’ll likely consider 3rd-party LLM routing solutions. We’ll break down two popular options, LiteLLM and Portkey, and help you decide when to use one over the other.
LiteLLM overview
LiteLLM is an OpenAI-compatible SDK and proxy gateway that lets you route requests across many LLM providers through a consistent interface (often as gateway infrastructure you run yourself).
Pros
Broad multi-provider support via one OpenAI-format interface: This makes it easy to standardize app code while swapping backends
LiteLLM offers an OpenAI-compatible API that routes across providers
Reliability features: You can use retries/fallbacks across configured deployments, which is useful for handling provider outages/degradations
Can be self-hosted: You’ll have maximum control over deployment, compliance/data handling, and custom routing policies (i.e., no external gateway dependency)
Cons
Operational burden: You’ll need to deploy, scale, and monitor it as a tier-0 dependency, and outages can affect all AI features behind it
Requires in-house expertise: This spans everything from configuring it to extending it to maintaining it
Isn’t enterprise ready out of the box: Your security posture depends on how you harden and operate it. For example, you may need to build/maintain governance, logging/retention, access controls, etc.
Portkey is an AI gateway layer between your app and multiple LLM providers. It provides a single integration point to route requests and observe/trace production traffic while you bring your own provider API keys.
Pros
Strong observability: You’ll get detailed request logs/traces for debugging. This includes details like latency, cost, model/provider selection, retry path, and errors
A snapshot of Portkey’s logs
Built-in reliability controls: Like LiteLLM you can use retries/failovers as well as circuit-breaker/canary-style mechanisms
More “ops/governance” primitives out of the box: You can build production ops and governance controls, like budgets, rate limits, and audit-grade access controls, so you don’t have to build those layers around a basic proxy yourself
Cons
Doesn’t unify underlying model billing: You still manage/pay provider accounts separately
Can be more “platform” than minimal proxy: This may be heavier than needed for small prototypes or teams wanting the lightest-weight layer
Adds a separate gateway bill: Portkey charges for the gateway platform itself, in addition to whatever you pay LLM providers
Given all the pros and cons of each platform, it can be hard to decide on the one that’s best for your AI products. Here are two general rules of thumb to follow:
When to use Portkey over LiteLLM: You want a more “production platform” gateway with stronger built-in ops and governance out of the box. This includes deep request-level observability and traces, budgets, and rate limits
When to use LiteLLM over Portkey: You want maximum control over where and how the gateway runs, such as self-hosting it in your own environment for compliance or customization
Don’t settle for LiteLLM or Portkey
Merge Gateway is a managed control plane that sits between your application and LLM providers, giving you a unified interface across models. It also offers built-in routing and fallback, cost governance, observability, security controls, and billing.
Here’s how Merge Gateway stands out from LiteLLM and Portkey:
Fully-managed control plane: You can avoid running the gateway as a tier-0 service the way you typically do with self-hosted approaches
Unified billing: You’ll have consolidated spend visibility across providers, rather than managing fragmented provider invoices and accounts
Merge Gateway lets you analyze spend across providers, models, and projects
Built-in cost governance and optimization features: This includes real-time budget enforcement and levers like context compression and semantic response caching
Enterprise security layered into the gateway: Access DLP-style controls and policy-aware compliance checks, not just routing and logs
Jon Gitlin is the Managing Editor of Merge's blog. He has several years of experience in the integration and automation space; before Merge, he worked at Workato, an integration platform as a service (iPaaS) solution, where he also managed the company's blog. In his free time he loves to watch soccer matches, go on long runs in parks, and explore local restaurants.
Read more
AI-powered issue resolution is now available in Merge Unified
Product
7 best practices for authentication in AI agents
AI
Introducing the Universal Context Layer: a company brain that works with every AI tool and agent