BLOCK 4 · AI GATEWAY (PRODUCTION)3:43 – 3:58 · 15 min · 4L / 11HO · Lab
TOPIC 4.6 / 10 · HO #5 · ★ LOAD-BEARING
Routing rule
The workshop's "OSS earns its keep" moment. One rule, one gateway, real production-grade
cost-and-failover infrastructure. The 3+3 provider split landing in your terminal is the evidence.
★ LOAD-BEARING — DO NOT CUT
4.6
Routing Rule — provider split + fallback
15 min4L / 11HO3:43 – 3:58★ LOAD-BEARING
Slide 1 / 3 · Routing primitives
What Bifrost OSS gives you for routing
CEL-based conditions — built via Rule Builder (AND/OR + Add Rule), CEL emitted as a read-only preview
Weighted targets — each target carries Provider + Model + Weight (both Provider and Model optional; empty = use incoming request value)
Fallback chains — Provider required, Model optional per fallback
Priority ordering — lower number = higher priority (0 is highest)
Chain Rule(advanced) — re-evaluates rules with the resolved provider/model as new context, e.g., normalize a model alias first, then route
Slide 2 / 3 · Three production uses
Same primitive, different jobs
Routing rule targets can pin provider, model, both, or neither (leave empty → use the incoming request's value). That flexibility is the whole point — one primitive, many jobs.
Production use
How it maps to a rule
A/B test two models on two providers
Each target pins Provider + Model + Weight (e.g., 50% Anthropic/claude-sonnet · 50% OpenAI/gpt-4o-mini)
Provider failover for the same model
Target pins provider only (model = incoming); Fallback list does provider failover
Tier-based routing
Rule Builder: headers.x-tier == "premium" → target a premium-provider
VK provider_configs (allowed_models + weights inside one key) is the other routing lever — used when you want a single key to constrain models per-provider. Routing rules operate at the gateway; VK provider_configs operate at the key. Both compose.
Aliases swap a model. Routing rules swap a provider. Different lever, same goal.