Bifrost
github.com/maximhq/bifrost- Category
- Developer Tools
- Rank
- No. 826Tools index
- Pricing
- Open Source
- Type
- TOOL
- Use case
- Models: Train & Run
- Interfaces
- API · Web · Client SDK
- GitHub
- 10.0k stars
- Latest release
- helm-chart-v2.1.50
- Date
About
An open-source AI gateway written to act as an LLM gateway, MCP gateway and agent gateway. It exposes one OpenAI-compatible API across many model providers, with failover, load balancing, semantic caching, virtual keys and budgets. It runs through npx or Docker and has a built-in web UI for configuration and monitoring. Its overhead figures are the project's own claims.
What it does
Bifrost is a self-hosted proxy, written in Go, that sits between your application and the model vendors. Your code talks to one local endpoint, and Bifrost translates each request for whichever vendor a rule or fallback picks, then translates the answer back. It also accepts each vendor's native request format at its own address prefix, so existing OpenAI, Anthropic or Google SDK code switches over by changing the base URL. Optional plugins add response caching, per-key spending limits and rule-based routing, and the configuration web interface is compiled into the same binary.
Why it's ranked here
The plumbing behind the feature list is real. Caching, spend control and routing are separate plugins with stated defaults, and the routing engine compiles rules written in CEL, Google's small expression language, to choose provider, model, fallback chain and key per request. A single Go binary, an npx launcher, a Docker image and an embeddable Go library cover most deployment shapes. The case against is the open-core line: clustering, adaptive load balancing, guardrails and several export integrations are reserved for the paid enterprise build, and the headline overhead figure comes from the project's own benchmark.
What's good
The cache is more careful than most. It checks an exact hash of the request first and only then falls back to embedding similarity, with a five-minute default lifetime and a 0.8 similarity threshold. It skips conversations longer than three messages, does not store tool-call answers unless told to, and by default keeps entries private to the key or user that wrote them. Streamed answers are stored only after every chunk is captured, and a stream with a chunk that failed to save is never cached. Without a database, spend control still runs in memory and warns about it at startup.
Tradeoffs
Caching does nothing until you supply a cache key, either a default in config or one per request, which is easy to miss. Without a persistent config store, budgets and usage live in memory and are lost on restart. Session-aware complexity routing refuses to start without a shared key-value store. The control surface is large: the server's callback interface spans plugins, pricing, teams, virtual keys, MCP clients and OAuth token caches. The README lists an MCP gateway among enterprise features even though the open build exposes an MCP tool endpoint, so confirm which edition covers your need. The latency table covers two AWS instance sizes, measured by the vendor.
How to use it well
Pick it if you call several model vendors in production and want failover, per-team budgets and one place to meter usage without writing that layer yourself. Start with the Docker image and a mounted data directory so configuration and logs survive restarts, hand each team its own virtual key, and set a cache key only for workloads that repeat prompts. Go services can embed the core library and skip the network hop. If you use one vendor and need no spend control, the vendor's own SDK is simpler. Verify enterprise-only features before planning around clustering or guardrails.
Technical notes+
transports/bifrost-http/main.go embeds the UI with go:embed, imports automaxprocs for container CPU limits, reads BIFROST_HOST and LOG_LEVEL, defaults to localhost:8080, and starts a pprof server beside the fasthttp server; its doc comment says OPENAI_API_KEY, ANTHROPIC_API_KEY and MISTRAL_API_KEY are auto-detected when no config file exists, and lists native endpoints under /openai, /anthropic and /genai. transports/bifrost-http/server/server.go wires fasthttp/router, Prometheus and gorm with the governance, logging, otel, prompts, routing, semanticcache and telemetry plugins, and names datadog, bigquery, pubsub and kafka in an enterprisePlugins list. plugins/semanticcache/main.go sets DefaultCacheTTL 5m, DefaultCacheThreshold 0.8 and DefaultConversationHistoryThreshold 3, offers a direct-only mode via Dimension=1, and disables caching when DefaultCacheKey is empty and no per-request key is set. plugins/governance/main.go uses the sk-bf- virtual key prefix, reads the x-bf-vk header, and falls back to an in-memory store when configStore is nil. plugins/routing/main.go compiles CEL rule programs and returns an error when session routing has no KVStore. framework/plugins/main.go classifies loaded plugins by hook set (LLM, MCP, HTTP transport, observability). The Makefile includes Fly, ECS and local Kubernetes recipes and can source secrets from Infisical or a dotenv file. cli/main.go is a separate CLI entry point.
Observed
- Language
- Go, HTTP server built on fasthttp
- Install surface
- npx launcher (@maximhq/bifrost), Docker image (maximhq/bifrost), Go module for the core library
- Interfaces
- HTTP API, embedded web UI, Go library, separate CLI binary
- Provider-native endpoints
- OpenAI, Anthropic and Google GenAI request formats accepted at their own path prefixes
- Default bind
- localhost on port 8080, overridable with BIFROST_HOST or the host flag
- Cache defaults
- Exact-hash lookup then embedding similarity; 5 minute TTL, 0.8 cosine threshold, skips conversations over 3 messages
- Cache activation
- Disabled unless a default or per-request cache key is set
- Virtual keys
- Prefixed sk-bf-, sent in the x-bf-vk header; mandatory mode is configurable
- Edition split
- Datadog, BigQuery, Pub/Sub and Kafka plugins listed as enterprise-only in the server code
- Deployment recipes
- Makefile includes Fly, ECS and local Kubernetes recipes
- Performance figures
- Vendor-reported: 11 microseconds added latency at 5,000 RPS on a t3.xlarge
Read from README.md, Makefile, transports/bifrost-http/main.go, transports/bifrost-http/server/server.go, transports/bifrost-http/lib/lib.go, framework/plugins/main.go, plugins/semanticcache/main.go, plugins/governance/main.go, plugins/routing/main.go, cli/main.go.
Similar tools
Tags
Editorially curated, with community endorsements as a secondary signal. Corrections welcome.