Prompt
What should I use for routing requests between multiple LLM providers?
Latest observation
If you want to route requests across multiple LLM providers, the best choice depends on whether you want simple failover/load balancing or policy-based routing with observability, retries, caching, and cost control.
Good options
1) LiteLLM
Best general-purpose answer for most teams.
- Supports many providers through one OpenAI-compatible interface
- Can do:
- provider fallback
- load balancing
- retries
- spend tracking
- rate-limit handling
- logging/observability
- Works well as a routing proxy or as a library in your app
Use this if: you want a practical, widely used router without building a lot yourself.
2) OpenRouter
Best if you want a hosted aggregation layer.
- One API for many models/providers
- Easy to switch models
- Handles provider access and routing for you
Use this if: you want convenience and don’t mind depending on a third-party broker.
3) Vercel AI Gateway / similar hosted gateways
Good if you’re already in a specific ecosystem and want minimal ops.
Use this if: you want managed routing and are already using that platform.
4) Custom router
Best if routing rules are business-specific.
Use your own service if you need:
- choose provider based on prompt type
- cost/performance SLAs
- data residency / compliance constraints
- custom fallbacks and A/B tests
- per-tenant policies
Use this if: you have strong requirements that off-the-shelf routing won’t cover.
My recommendation
- Most teams: start with LiteLLM
- If you want a hosted aggregator: OpenRouter
- If you need strict control/compliance: build a custom router
Things your router should ideally handle
- provider fallback
- retries with backoff
- timeouts
- rate-limit detection
- cost-aware routing
- model capability matching
- logging and tracing
- response normalization
If you want, I can give you:
- a feature comparison table of LiteLLM vs OpenRouter vs custom routing, or
- a recommended architecture for routing in production.