Running Non-Anthropic Models in Claude Code via an Enterprise AI Gateway
TL;DR: Claude Code is a powerful agentic coding tool, but it's locked to Anthropic's models by default. Bifrost, an open-source AI gateway by Maxim AI, lets you route Claude Code requests through any LLM provider, including OpenAI, Google Gemini, Mistral, and more, with a simple environment variable change. No client modifications. No custom proxies. Just production-grade multi-model access in under a minute.
The Claude Code Lock-In Problem
Claude Code has quickly become one of the most capable agentic coding tools available. It brings Claude's reasoning abilities directly into the terminal, letting developers delegate complex coding tasks, debug issues, and architect solutions from the command line.
But there's a catch: Claude Code only works with Anthropic's models out of the box.
For engineering teams operating in production environments, this creates real friction. You might need to route requests through GPT-4o for specific tasks where it excels, use Gemini for cost-effective bulk operations, or fall back to a different provider when Anthropic's API hits rate limits. Some organizations have compliance requirements that mandate specific cloud providers like AWS Bedrock or Google Vertex AI. Others simply want the flexibility to benchmark different models against each other without switching tools.
The underlying reason is straightforward: Anthropic's API format differs significantly from the OpenAI-compatible standard that most providers have adopted. Claude Code speaks Anthropic's protocol natively and doesn't offer a built-in way to swap providers.
How Bifrost Solves This
Bifrost is an open-source, high-performance AI gateway built in Go by Maxim AI. It sits between your application (in this case, Claude Code) and any LLM provider, translating requests across API formats transparently.
The integration works at the transport layer. Claude Code sends Anthropic-formatted requests to what it thinks is Anthropic's API. Bifrost intercepts those requests, converts them to the target provider's format, forwards them, and translates the responses back into Anthropic's format before returning them to Claude Code. The client never knows the difference.
This means you can point Claude Code at GPT-4o, Gemini, Mistral, or any of the 1000+ models Bifrost supports, all without modifying the Claude Code binary or writing custom proxy scripts.
Setup in Under a Minute
Getting started requires just two environment variables:
export ANTHROPIC_BASE_URL="<http://localhost:8080/anthropic>"
export ANTHROPIC_API_KEY="dummy-key"
ANTHROPIC_BASE_URL redirects Claude Code's API calls to Bifrost's local endpoint. The /anthropic path routes requests to Bifrost's Anthropic-compatible handler.
ANTHROPIC_API_KEY is set to a placeholder value because Bifrost handles the actual provider authentication on the backend. If you're using an Anthropic MAX account, Bifrost integrates with session-based auth out of the box, so this variable may not even be needed.
To get Bifrost running:
npx -y @maximhq/bifrost
That's it. Bifrost starts with a web UI at localhost:8080 where you can configure providers, add API keys, and set routing rules visually. No YAML files, no Docker compose configurations for basic usage.
What You Unlock Beyond Model Switching
Routing Claude Code through Bifrost isn't just about swapping models. It opens up several enterprise-grade capabilities that matter in production.
Automatic Failover. If your primary provider goes down or starts returning errors, Bifrost automatically reroutes traffic to a configured fallback. No manual intervention, no 3 AM pages.
Observability. Every request flowing through Bifrost gets logged with token usage, latency, and full request/response inspection. The built-in observability dashboard gives you real-time visibility into how Claude Code is consuming API resources, which is critical for teams managing budgets across multiple developers.
MCP Tool Injection. Model Context Protocol tools configured in Bifrost automatically become available to Claude Code. Bifrost injects MCP tools into the request's tools array before forwarding it to the model provider. This means Claude Code can use filesystem tools, web search, database queries, or any custom MCP server without any client-side configuration.
Governance and Cost Control. Bifrost supports virtual keys with independent budgets, rate limiting, and access control. For teams with multiple developers using Claude Code, this prevents runaway costs and enforces usage policies at the gateway level.
Semantic Caching. Repeated or similar queries get served from Bifrost's semantic cache, reducing both latency and cost without any changes to how developers interact with Claude Code.
Why an AI Gateway Matters for Coding Agents
As AI coding tools become central to development workflows, the infrastructure layer beneath them becomes a critical dependency. Running Claude Code directly against a single provider's API works for individual developers experimenting locally. It doesn't work for engineering organizations that need reliability, cost visibility, and the flexibility to evolve their model strategy over time.
An AI gateway like Bifrost decouples the tool from the provider. Your developers get to keep using Claude Code's excellent agentic interface. Your infrastructure team gets centralized control over which models are used, how much they cost, and what happens when things break.
Bifrost adds just 11 microseconds of overhead at 5,000 requests per second, so the gateway layer doesn't become a bottleneck even for the most demanding workloads.
Getting Started
- Install Bifrost:
npx -y @maximhq/bifrost - Configure your preferred providers through the web UI
- Set the two environment variables
- Run
claudeas usual
For teams already invested in Claude Code, Bifrost offers the path of least resistance to multi-model flexibility. For those evaluating AI coding tools, it removes the single-provider constraint entirely.
Explore the full Bifrost documentation, check out the GitHub repository, or book a demo to see how Bifrost fits into your AI infrastructure stack.