Documentation Index
Fetch the complete documentation index at: https://mintlify.com/helicone/helicone/llms.txt
Use this file to discover all available pages before exploring further.
How Routing Works
Helicone AI Gateway intelligently routes your requests to the best available provider based on:- Authentication method (BYOK vs PTB)
- Provider priority (OpenAI, Anthropic, etc.)
- Cost optimization
- Availability and rate limits
- Explicit routing rules
Routing Priority
When you specify a model without a provider, the gateway builds a list of attempts and tries them in order:Provider Priority
Within BYOK and PTB groups, providers are prioritized by:
- Native provider (e.g., OpenAI for GPT models)
- Major cloud providers (Azure, Bedrock, Vertex)
- Alternative providers (DeepInfra, OpenRouter, etc.)
Routing Examples
Automatic Routing
Let the gateway choose the best provider:- If you have an OpenAI BYOK key: Uses OpenAI directly
- If no BYOK key: Uses PTB (Helicone billing)
- Automatically tries alternatives if the first attempt fails
Explicit Provider Routing
Specify the exact provider you want:Explicit routing still respects BYOK → PTB priority. If you have a BYOK key for the specified provider, it’s used first.
Multi-Model Fallback
Specify multiple models to try in order:- Tries OpenAI BYOK (if configured)
- Falls back to OpenAI PTB
- Then tries Azure BYOK (if configured)
- Then Azure PTB
- Finally tries DeepInfra
Provider Exclusions
Exclude specific providers from automatic routing:!provider syntax excludes providers globally for all models in the comma-separated list.
Provider Priority Order
The gateway uses the following priority order for routing (within BYOK and PTB groups):- OpenAI Models
- Anthropic Models
- Google Models
- Meta Models
For GPT models (gpt-4o, gpt-5, o1, etc.):
- OpenAI (native provider)
- Azure OpenAI
- Alternative providers (DeepInfra, OpenRouter, etc.)
This priority order is implemented in the
AttemptBuilder class and can be customized with explicit routing or exclusions.BYOK vs PTB Routing
BYOK (Bring Your Own Key)
When you configure provider keys in Settings → API Keys:- Priority: BYOK attempts always come first
- Billing: Direct from the provider
- Failover: Falls back to PTB if BYOK fails
PTB (Pass-Through Billing)
When using Helicone’s API key without BYOK:- Priority: After BYOK attempts
- Billing: Through Helicone (add credits at helicone.ai/credits)
- Authentication: Single API key for all providers
Regional Routing
Some providers support regional endpoints:AWS Bedrock
Azure OpenAI
Configure Azure deployments in Settings → API Keys, then:Cost-Optimized Routing
The gateway considers provider pricing when routing:Cost Tracking
View costs by provider in the Helicone dashboard
LLM Cost API
Access pricing data at helicone.ai/llm-cost
Routing Observability
Track which providers were attempted in the Helicone dashboard:View Request Details
Open any request in Requests
Advanced Routing
Model-Specific Provider Routing
Route different models to different providers:Conditional Routing
Route based on application logic:Routing Errors
The gateway returns errors when routing fails:Invalid model or provider name:
Invalid or missing API key:
Rate limit exceeded or insufficient credits:
Best Practices
Use Automatic Routing for Flexibility
Use Automatic Routing for Flexibility
Let the gateway choose providers automatically:This provides:
- Automatic BYOK → PTB fallback
- Cost optimization
- Built-in resilience
Explicit Routing for Compliance
Explicit Routing for Compliance
Use explicit providers when you need:
- Data residency requirements
- Specific SLAs
- Regulatory compliance
Configure BYOK for Cost Control
Configure BYOK for Cost Control
Add provider keys for:
- Better cost control
- Direct provider billing
- Priority routing
Monitor Routing Patterns
Monitor Routing Patterns
Use the Helicone dashboard to:
- Track provider usage
- Identify cost optimization opportunities
- Detect routing issues
Next Steps
Fallbacks
Configure automatic failover strategies
Getting Started
Start using the AI Gateway
Browse Models
Explore all available models
Cost API
Access provider pricing data
