Designed for tablet+. View on a tablet or larger screen for the intended layout.
CORE_WORKSHOP_v1.0
SPEAKER NOTES MODE — press s to hide
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 min 4L / 11HO 3: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.

Slide 3 / 3 · Five steps to routing rule

HO #5 — Routing rule (11 min)

  1. Sidebar → ModelsRouting RulesCreate New Routing Rule
  2. Name: workshop-route-1 · Description: optional · Priority: 0 (highest)
  3. Enable Rule toggle ON · Rule Builder empty (rule applies to all requests)
  4. Target 1: Provider anthropic · Model claude-sonnet-4-6 · Weight 0.5
  5. Add Target → Target 2: Provider openai · Model gpt-4o-mini · Weight 0.5
  6. Fallback: Provider anthropic (model empty → uses incoming) · Save Rule