BLOCK 4 · AI GATEWAY (PRODUCTION)3:30 – 3:43 · 13 min · 5L / 8HO · Lab
TOPIC 4.5 / 10 · HO #4 + STORAGE CHECK
Budget + storage check
Attach a budget — your circuit breaker. Then take three minutes to look at where the workshop's
Bifrost actually lives on disk — the production-grade persistence behind everything
you've built so far.
4.5
Budget — the circuit breaker
10 min3L / 7HO3:30 – 3:40
Slide 1 / 3 · Budgets compose three ways
Where budgets attach
TEAM SCOPING (a VK can belong to a team — inherits team-level caps)
└── VIRTUAL KEY (each VK carries its own budgets[] — multiple caps, different reset windows)
└── PROVIDER CONFIG (a VK can also cap per-provider — e.g., $50/h OpenAI, $200/h Anthropic)
Multi-budget per VK — one VK can have $50/day AND $1000/month simultaneously (v1.5.0+ — budgets are an array)
Per-provider caps inside a VK — useful when one VK fans across providers with different cost profiles
Team scoping — VKs that share a team_id inherit team budgets
Bifrost evaluates every cap that touches the request; first one hit wins.
Slide 2 / 3 · 402 Payment Required
When a cap trips
Bifrost returns HTTP 402
Body includes which cap tripped and which scope
The gateway is your circuit breaker
Runaway loop hits one VK's cap, not your whole infra
Defaults note: If --app-dir is NOT specified, Bifrost uses the OS config directory — ~/.config/bifrost/ on macOS/Linux. We chose workshop-local so attendees with pre-existing Bifrost installs don't collide.
Production note: SQLite is the default for single-node OSS. The storage swap (SQLite → PostgreSQL via config_store.type: "postgres" in config.json) is the foundation real production deployments build on. Same UI, different backend — invisible to attendees' app code.
Slide 3 / 3 · Verify (60-second HO)
Restart-safe by default
Ctrl-C your Bifrost terminal
npm run bifrost again
Refresh the dashboard
Providers · VK · budget · all still there
"Restart-safe by default. That's production-grade behavior, not an accident."
Production-tier callout: OSS gives you this on day one. A real production deployment runs on Bifrost Enterprise — same persistence model, plus clustering (multi-node), SSO / OIDC (Okta, Entra, Google, GitHub), Vault for API key management, RBAC + team-level governance, and in-VPC deployment. The mental model you're learning now is what scales up.