TL;DR: Bifrost is a Go-based AI gateway adding only 11µs overhead at 5K rps while unifying 20+ LLM providers through an OpenAI-compatible API. Key differentiators: Virtual Keys as governance entities (permissions, budgets, MCP filtering per consumer), Code Mode that slashes token usage by 92.8% at 500+ tools, and a Skills Repository for distributing Agent Skills across Claude Code/Codex. Apache 2.0 OSS core with Enterprise upsell for HA clustering, OIDC federation, and audit-grade compliance.
Bifrost positions itself as “the fastest way to build AI applications that never go down.” It’s a single gateway sitting between your application and every LLM provider, handling failover, load balancing, governance, and observability — all with an OpenAI-compatible API that requires zero code changes beyond swapping the base URL.
This deep dive covers architecture, the MCP system (code mode, agent mode, tool filtering), the Go plugin system, Skills Repository, and how Bifrost monetizes an MIT-licensed open source core.
Architecture: Three Interfaces, One Governance Engine
Bifrost exposes three interfaces:
| Interface | Purpose |
|---|---|
| HTTP API Gateway | OpenAI-compatible REST endpoint. Drop-in replacement for any provider SDK. |
| Go SDK | Embed directly into Go applications. Zero network hop overhead. |
| Web UI | Visual configuration for virtual keys, providers, routing, observability. |
All three route through the same core: a Virtual Key system that acts as the governance entity for every request.
Client → Bifrost → Virtual Key (governance/routing) → LLM ProviderVirtual Keys: Not Just API Keys
Virtual Keys are the core abstraction. Each VK carries:
- Permissions — which providers/models are accessible
- Budgets — spending caps
- Rate limits — request throttling
- Routing rules — which provider to use, failover chains
- MCP tool filtering — which tools are available to this consumer
This is the key insight: instead of scattering governance across provider dashboards, Bifrost centralizes it in one place. Each consumer (user, service, team) gets a VK that defines their access boundary.
Deployment Options
| Mode | Description |
|---|---|
| Self-hosted | Docker/Kubernetes. Full control, runs on your infrastructure. |
| Enterprise Cloud | Managed service. Bifrost operates the gateway for you. |
| Edge | Lightweight agent on every org computer. Intercepts all AI traffic — even apps that don’t support proxying. Ensures nothing bypasses governance. |
The Edge agent is the compliance killer feature: no more shadow AI where developers bypass company AI policies by using personal API keys.
Performance Claims
Bifrost adds 11µs of overhead at 5,000 requests per second. Built in Go for low-latency, high-throughput operation.
MCP: The Model Context Protocol Layer
Bifrost’s MCP implementation is where it gets interesting. Rather than just proxying MCP requests, Bifrost adds four major features on top.
Tool Filtering: Three-Level Stack
Bifrost filters MCP tools at three stacked levels. A tool must pass ALL applicable filters to be available:
| Level | Scope | Example |
|---|---|---|
| Client config | tools_to_execute baseline whitelist | ["read_file", "list_directory"] |
| Request headers | Per-request override | x-bf-tools: calculator |
| Virtual Key config | Per-consumer restrictions | Finance team VK → no filesystem tools |
This enables fine-grained access control: the same MCP server exposes different tools to different consumers based on their virtual key.
Code Mode: LLM Writes Python to Orchestrate Tools
This is the standout feature. When you connect 8-10 MCP servers with 150+ tools, every LLM request includes all tool definitions in context. The model spends most of its budget reading tool catalogs instead of doing work.
Code Mode solves this by exposing only 4 generic tools. The LLM writes Python/Starlark code that orchestrates everything in a sandbox:
| Metric | Classic MCP | Code Mode | Improvement |
|---|---|---|---|
| Input tokens (508 tools) | 1.15M/query | 83K/query | 92.8% reduction |
| Estimated cost | $377/round | $29/round | 92.2% lower |
| Execution speed | Baseline | 40% faster | — |
The savings scale with tool count. At 96 tools: 58% reduction. At 251 tools: 84.5%. At 508 tools: 92.8%.
Agent Mode: Autonomous Tool Execution
Agent Mode transforms Bifrost from a gateway into an autonomous agent runtime. When enabled:
- LLM returns tool calls
- Bifrost auto-executes approved tools
- Results fed back to LLM
- Loop repeats until no more calls or max depth reached
Configuration uses two fields:
tools_to_execute: which tools are available (whitelist)tools_to_auto_execute: which tools can run without approval (subset)
Not compatible with streaming. The execution loop requires complete responses before proceeding.
Tool Hosting: No External MCP Server Needed
Register custom tools directly in your Go application:
- Define tool schema (OpenAI function format)
- Implement handler function
- Register via Bifrost SDK
No external MCP server process required. The tool runs in-process with Bifrost.
Session Management
Per-user MCP sessions with OAuth token lifecycle. Three states: active (valid, auto-refreshes), needs_reauth (credential dead), orphaned (user lost access, token still alive). Actions: re-authenticate, edit, revoke.
Plugin System: Go’s Native .so Architecture
Bifrost extends through Go’s standard library plugin system. Plugins are shared object files (.so) loaded at runtime.
Hook Points
| Hook | When | Purpose |
|---|---|---|
PreLLMHook | Before LLM call | Modify request, add headers |
PostLLMHook | After LLM response | Transform response, log |
HTTPTransportPreHook | Before upstream call (v1.4+) | Modify upstream request |
HTTPTransportPostHook | After upstream response (v1.4+) | Modify upstream response |
Init | Plugin load | Setup state |
Cleanup | Plugin unload | Teardown state |
Dynamic vs Static Builds
Bifrost ships statically linked by default (portable, no external dependencies). To use plugins, you need a dynamically linked binary:
make build DYNAMIC=1- Static: portable, can’t load plugins
- Dynamic: can load plugins, must match target libc (glibc vs musl)
- Linux/macOS only — Windows not supported by Go’s plugin system
Use Cases
- Transform requests/responses
- Custom validation logic
- External system integration (logging, monitoring)
- Custom caching strategies
- Response enrichment
Skills Repository: Distribute Agent Instructions
Bifrost’s Skills Repository turns the gateway into a central hub for managing Agent Skills — reusable SKILL.md instructions plus supporting files.
How It Works
- Create skills from the Bifrost dashboard (two-pane editor)
- Version with SemVer — immutable published versions
- Marketplace URLs — public for CLI agents to fetch
- Install in Claude Code/Codex — register Bifrost as a skills marketplace
- Bundle install —
bifrost-all-skillsplugin for all skills at once
Skill Structure
| Field | Purpose |
|---|---|
name | Stable identifier (lowercase, hyphens). Immutable after creation. |
description | Shown in dashboard and marketplaces |
license | SPDX identifier (MIT, Apache-2.0) |
compatibility | List of supported harnesses |
allowed_tools | Experimental: tools the skill can use |
Skills can include reference files, examples, scripts, and assets. Management actions are authenticated and permission-gated.
Semantic Caching: Two Modes, Same Plugin
Bifrost caches LLM responses via two complementary paths:
Direct (Hash) Matching
Deterministic exact-match. Request normalized and hashed. Identical request = instant replay. No embeddings required.
Semantic (Similarity) Matching
Embedding-based lookup. Serves cached answer when new request is close enough to a previous one, even if wording differs.
Both can run together: direct first (fastest), semantic on miss. Streaming supported — cached responses replayed chunk-by-chunk.
Common gotcha: caching requires a cache key (x-bf-cache-key header or CacheKey context value). Without one, the request bypasses the cache entirely.
Telemetry: Prometheus and OpenTelemetry
Built-in monitoring at /metrics. No extra instrumentation needed.
| Category | Metrics |
|---|---|
| HTTP Transport | http_requests_total, http_request_duration_seconds, size histograms |
| Upstream Provider | Success/error rates, token usage, costs (USD), cache performance |
| Custom Labels | Configurable dimensions, runtime injection via x-bf-dim-* headers |
Async collection — zero-latency impact on requests.
Enterprise: What You Pay For
Bifrost Enterprise is a strict superset of the OSS gateway. Every OSS feature works identically. Enterprise adds:
| Capability | Detail |
|---|---|
| HA Clustering | High-availability deployment with multiple nodes |
| Predictive Load Balancing | Weighted distribution across API keys with model-specific filtering |
| Identity Federation | OIDC login with directory sync (Okta, custom IdP) |
| RBAC | Role-based access control for dashboard and API |
| Audit Logs | Immutable, timestamped trails. SOC2/GDPR/HIPAA/ISO27001 friendly. |
| Log Exports | S3, GCS, BigQuery, data lake integration |
| Datadog Connector | Native APM, LLM Observability, request tracing |
| Private Network | Deploy behind firewalls, no external connectivity required |
14-day free trial. No public pricing — contact sales.
Licensing and Commercialization
Apache 2.0 OSS Core
Bifrost core is Apache 2.0 licensed (GitHub: maximhq/bifrost). The Docker image at maximhq/bifrost is the OSS build — no enterprise features included. Enterprise UI (ui/app/enterprise/) is cleaned out during OSS builds via make cleanup-enterprise.
Commercialization Path
The strategy is classic OSS → Enterprise upsell:
- OSS Core — Free, Apache 2.0. Docker image
maximhq/bifrostis the OSS build. Enterprise features (HA clustering, OIDC, RBAC, audit logging) are excluded from OSS builds viamake cleanup-enterprise. Covers basic gateway, MCP, plugins, caching, observability. - Enterprise Add-on — HA clustering, OIDC, RBAC, audit logging, Datadog. Targets organizations that need compliance and scale.
- Edge Agents — Per-machine licensing potential for the compliance interceptor.
- Skills Repository — Marketplace dynamics. Potential revenue share on skill sales or premium marketplace tiers.
- Managed Cloud — Fully hosted option for organizations that don’t want to self-host.
Risk: Enterprise Features in OSS
The biggest risk to this model: if core OSS becomes too capable, enterprises see no reason to upgrade. Bifrost mitigates by keeping governance, compliance, and HA features behind the Enterprise paywall — exactly what enterprises need.
Request Options: The x-bf-* Header System
Bifrost controls behavior via HTTP headers (or Go SDK context keys):
| Header | Purpose |
|---|---|
x-bf-vk | Virtual key identifier |
x-bf-api-key / x-bf-api-key-id | Explicit API key selection |
x-bf-direct-key | Caller-supplied raw provider key (bypasses registered pool) |
x-bf-session-id | Key stickiness (requires KV store) |
x-bf-cache-key | Cache key for semantic/direct caching |
x-bf-dim-* | Custom telemetry dimension labels |
x-bf-send-back-raw-request/response | Include raw provider data |
x-bf-store-raw-request | Persist in log records |
x-bf-disable-content-logging | Per-request content logging override |
Integrations: Protocol Adapters
Integrations translate between Bifrost’s unified API and provider-specific formats. Supported:
| Integration | Purpose |
|---|---|
| OpenAI | Standard OpenAI SDK compatibility |
| Anthropic | Claude API compatibility |
| Google GenAI | Vertex AI / Gemini compatibility |
| LiteLLM | LiteLLM proxy compatibility |
| Langchain | Langchain framework integration |
| AWS Bedrock | Bedrock models via Bifrost |
Migration from direct provider → Bifrost requires changing only the base URL:
# Before: direct to OpenAIclient = OpenAI(api_key="your-key")
# After: through Bifrostclient = OpenAI( base_url="http://localhost:8080/openai", api_key="dummy-key" # Keys handled in Bifrost)Summary
Bifrost is a well-architected AI gateway that solves a real problem: provider sprawl, lack of governance, and the cost of managing multiple LLM connections. The 11µs overhead claim is credible for a Go-based proxy. The MCP features (especially Code Mode’s 92.8% token reduction) are genuinely innovative. The Skills Repository is a smart play for ecosystem lock-in.
The Apache 2.0 → Enterprise commercialization model is standard but workable. The key question: will the OSS version be good enough that enterprises never need to upgrade, or will the governance/compliance features create real pressure to pay?
References
- Bifrost AI Gateway — Overview — Bifrost Docs — https://docs.getbifrost.ai/overview
- Bifrost Edge — Overview — Bifrost Docs — https://docs.getbifrost.ai/edge/overview
- MCP Code Mode — Bifrost Docs — https://docs.getbifrost.ai/mcp/code-mode
- MCP Agent Mode — Bifrost Docs — https://docs.getbifrost.ai/mcp/agent-mode
- MCP Tool Filtering — Bifrost Docs — https://docs.getbifrost.ai/mcp/filtering
- MCP Sessions — Bifrost Docs — https://docs.getbifrost.ai/mcp/sessions
- Tool Hosting — Bifrost Docs — https://docs.getbifrost.ai/mcp/tool-hosting
- Plugins — Getting Started — Bifrost Docs — https://docs.getbifrost.ai/plugins/getting-started
- Skills Repository — Bifrost Docs — https://docs.getbifrost.ai/features/skills-repository
- Semantic Caching — Bifrost Docs — https://docs.getbifrost.ai/features/semantic-caching
- Telemetry — Bifrost Docs — https://docs.getbifrost.ai/features/telemetry
- Enterprise Overview — Bifrost Docs — https://docs.getbifrost.ai/enterprise/overview
- Request Options — Bifrost Docs — https://docs.getbifrost.ai/providers/request-options
- Integrations — Bifrost Docs — https://docs.getbifrost.ai/integrations/what-is-an-integration
- Bifrost GitHub — https://github.com/maximhq/bifrost


