Model Mapping
Default model equivalencies for seamless switching and load balancing
The AI Gateway includes default model mapping that handles equivalencies between models from different providers. This enables seamless switching, load balancing, and fallback scenarios without changing your application code.
The gateway ships with comprehensive default mappings that work out-of-the-box, but you can override them for your specific needs.
Getting Started
What is Model Mapping?
Model mapping defines equivalencies between models from different providers, enabling the gateway to automatically substitute similar models when:
- Load balancing across providers with different model names
- Provider fallback when your preferred provider is unavailable
- Cost optimization by routing to cheaper equivalent models
- Performance tuning by selecting faster equivalent models
For complete configuration options and syntax, see the Configuration Reference.
How Model Mapping Works
The gateway uses a 3-tier mapping system with automatic fallback. When load balancing routes a request to a different provider, the system checks for model equivalencies in this order:
Direct Support
First, check if the target provider offers the requested model directly.
If you request gpt-4o
and load balancing routes to OpenAI, no mapping needed - OpenAI supports gpt-4o
natively.
Router-Specific Mapping
Next, check for custom mappings defined in your specific router configuration.
These override both direct support and global defaults, giving you fine-grained control per router.
Global Default Mapping
Check organization-wide default mappings you’ve configured.
These apply to all routers unless overridden by router-specific mappings.
Built-in Default Mapping
Finally, fall back to the gateway’s built-in default mappings.
These are comprehensive defaults that ship with the gateway and cover all major models and providers.
Configuration Examples
The gateway ships with comprehensive default mappings that prioritize equivalent quality and capability. You only need custom mappings when you want to override these defaults for your specific use case.
Use case: You believe different models are more equivalent than the defaults suggest.
What happens: When load balancer routes a gpt-4o
request to Anthropic, it uses claude-3-opus
instead of the default claude-3-5-sonnet
mapping.
Use case: You believe different models are more equivalent than the defaults suggest.
What happens: When load balancer routes a gpt-4o
request to Anthropic, it uses claude-3-opus
instead of the default claude-3-5-sonnet
mapping.
Use case: Override defaults to avoid specific models you don’t want to use, even when they’re the logical equivalent.
What happens: Even though claude-3-5-haiku
is the logical equivalent, all requests get mapped to claude-3-5-sonnet
when routed to Anthropic.
Use case: Set organization-wide model preferences that apply to all routers by default.
What happens: All routers use these mappings unless they define their own router-specific overrides.
For complete configuration options and syntax, see the Configuration Reference.
Coming Soon
The following model mapping features are planned for future releases:
Feature | Description | Version |
---|---|---|
Intelligent Mapping | Automatically maintained model equivalencies that update with new model releases, eliminating the need for manual configuration | v2 |