Sandbox
@maximhq/bifrost

AI gateway for model routing and MCP

Bifrost sits in front of model providers and gives you one OpenAI-compatible API for requests, failover, load balancing, caching, and governance. It also includes MCP gateway support, a web UI, and enterprise features for clustering, guardrails, and observability.

7,956 stars1.2k forksGoUpdated 6d ago
Who it's for

Builders who want to route agent requests through one gateway across OpenAI, Anthropic, Bedrock, Vertex, and other model providers.

What it delivers

You can switch, balance, and protect model traffic from one gateway instead of managing each provider separately.

What it does

Unified OpenAI-compatible API

Send requests to many providers through one API instead of connecting to each provider separately.

Automatic fallback and load balancing

Move traffic across providers and API keys when one path fails or gets overloaded.

Semantic caching

Reuse similar responses to reduce cost and latency on repeated prompts.

MCP gateway support

Expose external tools like filesystems, web search, and databases through Model Context Protocol.

Governance and budget controls

Track usage, set limits, and control access with virtual keys, teams, and budgets.

Observability and logging

Collect Prometheus metrics, traces, and logs for request monitoring and troubleshooting.

Web UI and configuration options

Configure the gateway through the browser, API, or config files.

How to get it

  1. 1Step 1: Start Bifrost Gateway
    # Install and run locally
    npx -y @maximhq/bifrost
    
    # Or use Docker
    docker run -p 8080:8080 maximhq/bifrost
  2. 2Step 2: Configure via Web UI
    # Open the built-in web interface
    open http://localhost:8080
  3. 3Step 3: Make your first API call
    curl -X POST http://localhost:8080/v1/chat/completions \
      -H "Content-Type: application/json" \
      -d '{
        "model": "openai/gpt-4o-mini",
        "messages": [{"role": "user", "content": "Hello, Bifrost!"}]
      }'
  4. 4Best for: Language-agnostic integration, microservices, and production deployments
    # NPX - Get started in 30 seconds
    npx -y @maximhq/bifrost
    
    # Docker - Production ready
    docker run -p 8080:8080 -v $(pwd)/data:/app/data maximhq/bifrost
  5. 5Best for: Direct Go integration with maximum performance and control
    go get github.com/maximhq/bifrost/core

README

Bifrost AI Gateway

maximhq%2Fbifrost | Trendshift

Discord badge codecov Docker Pulls Run In Postman Artifact Hub License

The fastest way to build AI applications that never go down

Bifrost is a high-performance AI gateway that unifies access to 23+ providers (OpenAI, Anthropic, AWS Bedrock, Google Vertex, and more) through a single OpenAI-compatible API. Deploy in seconds with zero configuration and get automatic failover, load balancing, semantic caching, and enterprise-grade features.

Quick Start

Get started

Go from zero to production-ready AI gateway in under a minute.

Step 1: Start Bifrost Gateway

# Install and run locally
npx -y @maximhq/bifrost

# Or use Docker
docker run -p 8080:8080 maximhq/bifrost

Step 2: Configure via Web UI

# Open the built-in web interface
open http://localhost:8080

Step 3: Make your first API call

curl -X POST http://localhost:8080/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/gpt-4o-mini",
    "messages": [{"role": "user", "content": "Hello, Bifrost!"}]
  }'

That's it! Your AI gateway is running with a web interface for visual configuration, real-time monitoring, and analytics.

Complete Setup Guides:


Enterprise Deployments

Bifrost supports enterprise-grade, private deployments for teams running production AI systems at scale. In addition to private networking, custom security controls, and governance, enterprise deployments unlock advanced capabilities including adaptive load balancing, clustering, guardrails, MCP gateway, and other features designed for enterprise-grade scale and reliability.

Book a Demo

Key Features

Core Infrastructure

  • Unified Interface - Single OpenAI-compatible API for all providers
  • Multi-Provider Support - OpenAI, Anthropic, AWS Bedrock, Google Vertex, Azure, Cerebras, Cohere, Mistral, Ollama, Groq, and more
  • Automatic Fallbacks - Seamless failover between providers and models with zero downtime
  • Load Balancing - Intelligent request distribution across multiple API keys and providers

Advanced Features

  • Model Context Protocol (MCP) - Enable AI models to use external tools (filesystem, web search, databases)
  • Semantic Caching - Intelligent response caching based on semantic similarity to reduce costs and latency
  • Multimodal Support - Support for text, images, audio, and streaming, all behind a common interface.
  • Custom Plugins - Extensible middleware architecture for analytics, monitoring, and custom logic
  • Governance - Usage tracking, rate limiting, and fine-grained access control

Enterprise & Security

  • Budget Management - Hierarchical cost control with virtual keys, teams, and customer budgets
  • User Provisioning (OIDC) - OAuth 2.0 / OIDC login with background directory sync for teams, roles, and business units
  • Observability - Native Prometheus metrics, distributed tracing, and comprehensive logging
  • Secrets Management - Secure API key management with environment variables and deployment secrets

Developer Experience


Repository Structure

Bifrost uses a modular architecture for maximum flexibility:

bifrost/
├── npx/                 # NPX script for easy installation
├── core/                # Core functionality and shared components
│   ├── providers/       # Provider-specific implementations (OpenAI, Anthropic, etc.)
│   ├── schemas/         # Interfaces and structs used throughout Bifrost
│   └── bifrost.go       # Main Bifrost implementation
├── framework/           # Framework components for data persistence
│   ├── configstore/     # Configuration storage backends
│   ├── logstore/        # Request logging storage backends
│   └── vectorstore/     # Vector storages
├── transports/          # HTTP gateway and other interface layers
│   └── bifrost-http/    # HTTP transport implementation
├── ui/                  # Web interface for HTTP gateway
├── plugins/             # Extensible plugin system
│   ├── governance/      # Budget management and access control
│   ├── jsonparser/      # JSON parsing and manipulation utilities
│   ├── logging/         # Request logging and analytics
│   ├── maxim/           # Maxim's observability integration
│   ├── mocker/          # Mock responses for testing and development
│   ├── semanticcache/   # Intelligent response caching
│   └── telemetry/       # Monitoring and observability
├── docs/                # Documentation and guides
└── tests/               # Comprehensive test suites

Getting Started Options

Choose the deployment method that fits your needs:

1. Gateway (HTTP API)

Best for: Language-agnostic integration, microservices, and production deployments

# NPX - Get started in 30 seconds
npx -y @maximhq/bifrost

# Docker - Production ready
docker run -p 8080:8080 -v $(pwd)/data:/app/data maximhq/bifrost

Features: Web UI, real-time monitoring, multi-provider management, zero-config startup

Learn More: Gateway Setup Guide

2. Go SDK

Best for: Direct Go integration with maximum performance and control

go get github.com/maximhq/bifrost/core

Features: Native Go APIs, embedded deployment, custom middleware integration

Learn More: Go SDK Guide

3. Drop-in Replacement

Best for: Migrating existing applications with zero code changes

# OpenAI SDK
- base_url = "https://api.openai.com"
+ base_url = "http://localhost:8080/openai"

# Anthropic SDK
- base_url = "https://api.anthropic.com"
+ base_url = "http://localhost:8080/anthropic"

# Google GenAI SDK
- api_endpoint = "https://generativelanguage.googleapis.com"
+ api_endpoint = "http://localhost:8080/genai"

Learn More: Integration Guides


Performance

Bifrost adds virtually zero overhead to your AI requests. In sustained 5,000 RPS benchmarks, the gateway added only 11 µs of overhead per request.

Metrict3.mediumt3.xlargeImprovement
Added latency (Bifrost overhead)59 µs11 µs-81%
Success rate @ 5k RPS100%100%No failed requests
Avg. queue wait time47 µs1.67 µs-96%
Avg. request latency (incl. provider)2.12 s1.61 s-24%

Key Performance Highlights:

  • Perfect Success Rate - 100% request success rate even at 5k RPS
  • Minimal Overhead - Less than 15 µs additional latency per request
  • Efficient Queuing - Sub-microsecond average wait times
  • Fast Key Selection - ~10 ns to pick weighted API keys

Complete Benchmarks: Performance Analysis


Documentation

Complete Documentation: https://docs.getbifrost.ai

Quick Start

Features

Integrations

Enterprise


Need Help?

Join our Discord for community support and discussions.

Get help with:

  • Quick setup assistance and troubleshooting
  • Best practices and configuration tips
  • Community discussions and support
  • Real-time help with integrations

Contributing

We welcome contributions of all kinds! See our Contributing Guide for:

  • Setting up the development environment
  • Code conventions and best practices
  • How to submit pull requests
  • Building and testing locally

For development requirements and build instructions, see our Development Setup Guide.


License

This project is licensed under the Apache 2.0 License - see the LICENSE file for details.

Built with ❤️ by Maxim

Files in the repo

Repository payload42 top-level entries
  • .claude
  • .github
  • .greptile
  • cli
  • cmd
  • community
  • core
  • docs
  • examples
  • framework
  • helm-charts
  • nix
  • npx
  • plugins
  • recipes
  • scripts
  • terraform
  • tests
  • transports
  • ui
  • .coderabbit.yaml
  • .cursorignore
  • .dockerignore
  • .editorconfig
  • .envrc
  • .gitattributes
  • .gitignore
  • .infisical.json
  • .nvmrc
  • .pre-commit-config.yaml
  • .snyk
  • AGENTS.md
  • CODE_OF_CONDUCT.md
  • config.json
  • flake.lock
  • flake.nix
  • LICENSE
  • Makefile
  • pulse.yaml
  • README.md
  • SECURITY.md
  • THIRD_PARTY_NOTICES.md

Discussion (0)

Ask about usage, or say what you built with it

Sign in to join the discussion.

No comments yet. Be the first to say what this is good for.

More connectors

High-performance code intelligence MCP server. Indexes codebases into a persistent knowledge graph — average repo in milliseconds. 158 languages, sub-ms queries, 99% fewer tokens. Single static binary, zero dependencies.

43k

Universal provider proxy for OpenAI Codex & Claude Code — use any LLM (Claude, Gemini, Grok, DeepSeek, Ollama…) with Codex CLI, App, SDK, and Claude Code

14k
okf-memory/
okf-agent-memory

Git-native persistent memory for AI coding agents. Implements Google OKF v0.2 with sub-300µs in-memory BM25 search, embedded MCP server, and progressive disclosure. Slashes token bloat by 80% with zero external databases or dependencies. Built in pure Go.

547
tirth8205/
code-review-graph

Local-first code intelligence graph for MCP and CLI. Builds a persistent map of your codebase so AI coding tools read only what matters, with benchmarked context reductions on reviews and large-repo workflows.

31k
2akouwu/
reverify

Stop your AI from making things up — it proposes, deterministic tools decide, every claim checked against ground truth with evidence. Grounded facts and context survive resets. Reverse engineering is the proving ground. MCP server + CLI.

1.1k
t8y2/dbxConnectors

20 MB lightweight cross-platform database client for 90+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 90+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP Server。

19k