Migrating from Bifrost: Moving a Self-Hosted AI Gateway to a Managed One
By Mahizh Vannan · Published October 29, 2026 · Updated October 31, 2026
TL;DR
Teams usually leave Bifrost OSS for operational reasons, since multi-node live sync, SSO, RBAC and audit logs are Enterprise only, the v1.5.0 release carried 16 breaking changes, and someone has to be on call. For an application using the OpenAI SDK, the client change is three values (base URL, API key and model name). CEL routing rules, custom Go plugins, cache contents, request history and dashboards built on bifrost_* metrics do not carry over.
Bifrost is a good open source AI gateway, and many teams start there for the right reasons: it is free, fast and runs anywhere. The reasons teams later move off a self-hosted AI gateway are usually operational rather than functional. Someone has to run the cluster, keep PostgreSQL highly available, upgrade through breaking releases, and answer the security review. When that work stops being worth it, the question becomes how to move without breaking every application that calls the gateway.
This guide is the plan TrueFoundry would follow. It maps Bifrost’s concepts to a managed gateway (this guide uses the TrueFoundry AI Gateway as the destination), lists the client changes, and lays out a cutover with a rollback path. It also covers what does not carry over, so a team can scope the work honestly.
Where this guide draws on TrueFoundry’s own experience, from running Bifrost OSS v2.0.0 and from installing a TrueFoundry gateway plane in its own cluster in October 2026, this guide says so.
When a self-hosted AI gateway stops being worth it
If two or more of the triggers below are true, a managed gateway usually costs less than the engineering time.
The free tier of Bifrost is a complete gateway, so feature gaps are rarely the trigger. These usually are:
- A team needs more than one node. OSS replicas don’t share state. They read the same static
config.json, need a restart for every change, and keep budgets, rate-limit counters and key revocations per pod. Live sync is Enterprise only. - Security review. SSO, RBAC, audit logs, vault-backed secrets and guardrails are Enterprise features, priced by quote. Service identities don’t exist in either tier; services hold long-lived virtual keys.
- Upgrades. The v1.5.0 release carried 16 breaking changes and database migrations that cannot be rolled back. Someone has to read every release note and back up PostgreSQL before each upgrade.
- On-call. The gateway sits in the path of every model call. If it goes down at 2 a.m., it is the team’s page.
TrueFoundry’s posts on Bifrost pricing and Bifrost Enterprise vs OSS cover the buy-versus-run math in more detail.
Pick the deployment model first
“Managed” covers more than one shape, and the choice decides how much of the migration is infrastructure work. TrueFoundry offers three (deployment options):
| Model | What runs where | Pick it when |
|---|---|---|
| SaaS gateway | Gateway and control plane run on TrueFoundry’s infrastructure. Apps call https://gateway.truefoundry.ai. | A team wants zero infrastructure and its data policy allows a hosted gateway. |
| Gateway plane in a team’s cluster | The gateway (data plane) runs in a team’s Kubernetes cluster; the control plane stays hosted. Config syncs down to the gateway. | Model traffic must stay in a team’s network, but the team doesn’t want to run the control plane. |
| Fully self-hosted | Control plane and gateway both run in a team’s environment, including air-gapped. | Regulated environments where nothing may leave the team’s network. |
TrueFoundry used the middle option for its own evaluation. The gateway plane installs from a Helm chart and authenticates to the control plane with a gateway token; models, routing and access rules are configured in the control plane and synced to the gateway. The chart also deploys a Redis pod next to the gateway. Prerequisites are Kubernetes 1.27 or later, block-storage volumes, a domain and certificate for the gateway endpoint, an image pull secret from TrueFoundry, and egress from the cluster to the team’s control plane URL (deploy gateway plane). Self-hosting the gateway plane is on TrueFoundry’s Enterprise tier.
Step 1: inventory what Bifrost is doing today
Most migration surprises come from config nobody remembers writing. Before creating anything in the new gateway, list:
- Providers and keys: every provider, every key, key weights, and custom endpoints such as vLLM or Ollama.
- Virtual keys: owner (team, customer or none), allowed providers and models, budgets, rate limits, MCP tool access, and expiry.
- Routing: weighted provider configs, fallback chains, retry settings and every CEL routing rule, with its scope and priority.
- MCP: connected MCP servers, tool groups and their auth modes.
- Observability: content-logging settings, OTel and other connectors, retention, and any dashboards or alerts built on
bifrost_*metrics. - Plugins: custom Go plugins, semantic caching, and the Maxim plugin.
- Callers: every application, which SDK it uses, which Bifrost route it calls (OpenAI-compatible or a provider-native route), and which
x-bf-*headers it sends.
If a team runs Bifrost with a file-based config, config.json is most of this list. If a team uses the database-backed config store, read it back through the management API rather than the UI, so nothing is missed.
Step 2: map Bifrost concepts to the new gateway
The mapping below is the core of the migration. Bifrost behavior comes from Bifrost’s docs; TrueFoundry behavior comes from the TrueFoundry docs linked in each row.
| Bifrost | TrueFoundry AI Gateway | Notes |
|---|---|---|
| Provider with weighted keys | Provider (model) account with models; several accounts per provider (quick start) | Split keys a team wants to route between into separate accounts. |
| Model name openai/gpt-4o-mini | <account>/<model>, for example openai-main/gpt-4o-mini | Every caller’s model string changes unless a team puts a virtual model in front. |
| Virtual key (bearer secret, owned by a team, a customer or nothing) | Personal access tokens for people; virtual account tokens for services, with auto-rotation and secret-store sync (API keys) | The step that improves security most: each service gets its own identity. |
| Allowed providers and models on a key | Model access granted to users, teams and virtual accounts through roles | Grant per model, not tenant-wide. |
| Budgets (key, team, customer, provider, model) | Budget limiting rules matched on subjects, models, provider accounts and metadata; all matching rules must pass (budget limiting) | Start new budgets in audit mode for a week to compare against Bifrost’s numbers. |
| Request and token rate limits | Rate limiting rules for requests and tokens, partitioned by user, model, virtual account or metadata (rate limiting) | Rate limits cap throughput; budgets cap spend. Keep them separate. |
| Weighted routing, fallbacks, retries | Virtual models with weight, priority or latency strategies, retries and fallback status codes (virtual models) | A virtual model also gives callers one stable name across providers. |
| CEL routing rules | No one-to-one equivalent | Rewrite each rule as a virtual model, a metadata-scoped policy, or app-side model selection. See below. |
| x-bf-dim-* and x-bf-lh-* headers | X-TFY-METADATA header, usable in budget, rate-limit and logging rules and as metric labels | Callers change one header instead of many. |
| Guardrails (Enterprise) | Guardrails with validate and mutate modes, enforce or audit (guardrails) | Check which tenant-wide rules already exist before routing traffic; see the gotchas. |
| MCP clients and tool groups | MCP Gateway servers with inbound and outbound auth (MCP auth) | Per-user OAuth flows need users to re-consent. |
| Content logging on or off (global, per request, per connector) | Logging configs per user, team, virtual account, model or metadata, with redaction (logging configuration) | Decide logging rules before cutover; see below. |
| OTel plugin, Prometheus /metrics | OTel export from gateway settings; Prometheus /metrics when the gateway runs in a team’s cluster (OTel export) | Dashboards on bifrost_* metric names must be rebuilt. |
| Custom Go plugins | No direct equivalent | Re-implement as a custom guardrail, or move the logic into the app. |
Rewriting CEL routing rules
CEL rules are the part of a Bifrost config that does not translate mechanically. Sort each rule by what it is really doing:
- Splitting traffic or failing over (weighted targets, fallbacks): becomes a virtual model.
- Routing by team or environment (for example, a header like
x-environment): becomes a separate virtual model per environment, with access granted to the right team, or metadata-scoped policies. - Reacting to budget usage (moving traffic to a cheaper model past a threshold): becomes a budget rule plus a fallback, or a decision in the application.
- Anything else: write it down and decide whether it belongs in the gateway at all.
Step 3: change the clients
For an application using the OpenAI SDK, the change is three values: base URL, API key and model name.
from openai import OpenAI
# Before: Bifrost
client = OpenAI(base_url="http://bifrost.internal:8080/v1",
api_key="unused",
default_headers={"x-bf-vk": "sk-bf-team-search",
"x-bf-dim-environment": "production"})
client.chat.completions.create(model="openai/gpt-4o-mini", messages=msgs)
# After: TrueFoundry AI Gateway
client = OpenAI(base_url=GATEWAY_BASE_URL, # e.g. https://gateway.truefoundry.ai
api_key=VIRTUAL_ACCOUNT_TOKEN, # one per service
default_headers={"X-TFY-METADATA": '{"environment": "production"}'})
client.chat.completions.create(model="openai-main/gpt-4o-mini", messages=msgs)
A few things to check per caller:
- Auth becomes mandatory. In TrueFoundry’s testing, a default Bifrost OSS install accepted requests with no credentials, so some internal callers may never have sent one. Every TrueFoundry request carries a bearer token. Find those callers before cutover, not during it.
- Provider-native routes. If a caller uses Bifrost’s Anthropic, Gemini or Bedrock-compatible routes with the provider’s own SDK, check the destination’s native SDK support. TrueFoundry supports the OpenAI, Anthropic, Google Gen AI, Azure OpenAI and boto3 SDKs, with routing configuration supported for some and not others (native SDK support).
- Response shape. When TrueFoundry pointed the OpenAI Python SDK at Bifrost v2.0.0, four of six scenarios matched OpenAI exactly; the streaming role, logprobs and error shape differed. Code that parses Bifrost’s error bodies or works around its streaming quirks may need adjusting when it talks to a different gateway. Test error handling, not only the happy path.
- Provider differences don’t go away. In TrueFoundry’s Bifrost tests the same request shape produced different tool-schema strictness, reasoning parameters and model-retirement errors across providers. That is true behind any gateway, so keep per-provider contract tests in the team’s CI.
Step 4: cut over gradually, with a way back
- Stand up the new gateway next to Bifrost. Recreate providers, models, virtual accounts, budgets in audit mode, rate limits, guardrails and logging configs. Leave Bifrost untouched.
- Run contract tests against both gateways: non-streaming and streaming chat, tool calls, structured output, embeddings, error cases and each provider-native route the team uses.
- Move one low-risk service first. Switch its base URL, token and model names through config or a feature flag, so switching back is a deploy, not a code change.
- Compare for a week. Token counts and calculated cost per service should line up between Bifrost’s logs and the new gateway’s dashboard. A difference usually means a pricing or model-name mapping is wrong.
- Move the rest in batches, highest-volume services last. Flip budgets from audit to enforce once numbers agree.
- Keep Bifrost running read-only for a rollback window, then revoke its virtual keys. On multi-replica OSS, revoking a key does not propagate between pods, so restart every replica after revoking, or simply shut Bifrost down.
What does not carry over
- Request history. Bifrost’s SQLite or PostgreSQL schema is not a stable interchange format. If a team needs the history for audits or evals, export it through the logs API or the team’s existing connectors before decommissioning, and keep it outside the gateway.
- Custom Go plugins. They are compiled against a specific Bifrost core and Go version, so they move as a rewrite.
- CEL expressions, as above.
- Cache contents. Semantic and exact-match caches start cold on the new gateway.
- Dashboards and alerts built on
bifrost_*metric names and labels. - Bifrost-specific headers such as
x-bf-vk,x-bf-dim-*,x-bf-lh-*and the per-request logging override. - MCP OAuth consents for per-user connections; users authorize again.
Gotchas from TrueFoundry’s own setup
These come from installing a TrueFoundry gateway plane in TrueFoundry’s cluster and pointing test traffic at it.
- Tenant-wide guardrail rules apply to new callers immediately. TrueFoundry’s tenant already had a PII guardrail rule; its first test requests were rejected with HTTP 400 until TrueFoundry excluded the test virtual account from it. Review existing guardrail rules, and run new ones in audit mode, before moving production traffic.
- Request logging is on by default. With a hosted control plane, the gateway sends request logs to it. A team can keep the request and response data in a bucket in its own cloud instead, and logging configs can turn body logging off or redact it per team, model or metadata. Decide this with the security team before the first production request, not after.
- Self-hosted models register like any other provider. TrueFoundry registered an OpenAI-compatible endpoint running in its cluster as a self-hosted model and called it as
<account>/<model>. Internal vLLM or similar endpoints a team reaches through Bifrost today move the same way. - Size for the extra pod. The gateway-plane chart runs Redis alongside the gateway. Include it in the capacity and cost plan.
Is a managed gateway right for you?
Stay on self-hosted Bifrost if a team runs a single node, has the platform engineers to own it, and doesn’t need SSO, audit or service identities.
Move to Bifrost Enterprise if a team wants to stay on Bifrost and keep operating the gateway itself, but needs clustering and the security features. The team will still own the cluster, HA PostgreSQL and upgrades.
Move to a managed gateway if the operational load is the problem. Choose SaaS if the team’s data policy allows it, or a gateway plane in the team’s own cluster if model traffic has to stay inside the team’s network.
Why TrueFoundry as the destination
- A team chooses how managed. SaaS, a gateway plane in a team’s cluster with a hosted control plane, or fully self-hosted, including air-gapped.
- Config sync is the architecture. Gateway pods are stateless and receive config, users, virtual accounts and authorization rules from the control plane in real time; the full config is republished every 10 minutes so a missed update cannot drift, and gateways keep serving on their last config if the control plane is unreachable (gateway plane architecture). That replaces Bifrost’s restart-every-pod model on OSS.
- Service identity built in. Virtual accounts give each application its own token with scheduled rotation, a grace period and secret-store sync.
- Policy as rules. Budgets, rate limits, guardrails and logging are separate rule sets matched on who, which model and request metadata, with audit modes for safe rollout.
To see the product, start at the TrueFoundry AI Gateway page.
Related reading
- Bifrost pricing: OSS, Enterprise costs, and what teams should know
- Bifrost vs LiteLLM
- What is an LLM gateway?
- AI gateway on premise: all you need to know
- LiteLLM alternatives
Conclusion
Moving off a self-hosted AI gateway is less about the client change, which is small, and more about faithfully recreating keys, policies and routing, then cutting over one service at a time with a way back. Do the inventory first, map every virtual key to a real identity, rewrite CEL rules on purpose rather than by translation, and keep Bifrost running until the numbers agree.