---
description: Bifrost CLI lets you run Claude Code with models from OpenAI, Google, Mistral, and 23+ providers through a single command. No client modifications required.
title: Running Claude Code with Non-Anthropic Models Using Bifrost CLI
image: https://storage.ghost.io/c/84/03/8403f2f6-141c-411a-8f55-a32d4291533e/content/images/size/w1200/2026/07/running-claude-code-with-non-anthropic-models-using-bifrost--bifrost-weave.optimized.png
---

Try Bifrost Enterprise free for 14 days. [Request access](https://www.getmaxim.ai/#enterprise-trial)

[**Bifrost CLI**](https://docs.getbifrost.ai/quickstart/cli/getting-started)** lets you run Claude Code with models from OpenAI, Google, Mistral, and 23+ providers through a single command. No client modifications required.**

Claude Code is one of the most capable terminal-based AI coding agents available today. It handles file operations, runs terminal commands, edits code, and reasons through complex engineering tasks directly from the command line. But it ships with a hard constraint: Claude Code only works with Anthropic's models out of the box. For engineering teams that need provider flexibility, cost optimization, or model-specific strengths for different tasks, this creates a real bottleneck. Bifrost CLI solves this by routing Claude Code through the [Bifrost AI gateway](https://www.getmaxim.ai), enabling access to non-Anthropic models without modifying the Claude Code client.

## Why Run Claude Code with Non-Anthropic Models

Different models excel at different tasks. GPT-4o may perform better for certain codebases, Gemini offers larger context windows for monorepo work, and Groq-hosted Llama models deliver faster inference for lightweight operations. Without an intermediary layer, switching between these models requires manual reconfiguration for every session.

There are also operational concerns. Relying on a single provider introduces risks around rate limits, regional outages, and cost spikes. Teams running Claude Code across dozens of developers need centralized governance, failover redundancy, and usage visibility that a single-provider setup cannot provide.

[Bifrost](https://www.getmaxim.ai), the [open-source AI gateway](https://github.com/maximhq/bifrost) by [Maxim AI](https://www.getmaxim.ai), addresses these problems at the infrastructure layer. It sits between Claude Code and any LLM provider, translating Anthropic-formatted API requests to the target provider's format and returning responses in Anthropic's format. Claude Code never knows the difference.

## How Bifrost CLI Works with Claude Code

[Bifrost CLI](https://docs.getbifrost.ai/quickstart/cli/getting-started) is an interactive terminal tool that automates the connection between Claude Code and the Bifrost gateway. Instead of manually exporting environment variables and configuring provider paths, you run a single command:

```bash
npx @anthropic-ai/bifrost-cli
```

The CLI walks you through a structured setup:

- **Gateway URL**: Enter the base URL of your Bifrost instance (typically `http://localhost:8080` for local setups)
- **Virtual key**: If your gateway uses [virtual key authentication](https://docs.getbifrost.ai/features/governance/virtual-keys), provide it here. Bifrost stores this securely in your OS keyring.
- **Harness selection**: Choose Claude Code from the available options (Bifrost also supports Codex CLI, Gemini CLI, and others)
- **Model selection**: The CLI fetches available models from your gateway's `/v1/models` endpoint and presents a searchable list. Pick any model from any configured provider.

Once confirmed, Claude Code launches with all necessary environment variables configured automatically. No manual `export ANTHROPIC_BASE_URL` commands required.

## Overriding Claude Code Model Tiers

Claude Code organizes its model usage into three tiers: Sonnet (default for most tasks), Opus (complex reasoning), and Haiku (fast, lightweight operations). With Bifrost, you can override any of these tiers to use models from entirely different providers using the `provider/model-name` format:

```bash
export ANTHROPIC_DEFAULT_SONNET_MODEL="openai/gpt-5"
export ANTHROPIC_DEFAULT_OPUS_MODEL="gemini/gemini-2.5-pro"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="groq/llama-3.3-70b-versatile"
```

Bifrost automatically translates Anthropic API requests to the target provider, so this works without any SDK or client changes. You can also switch models mid-session using the `/model` command:

```
/model openai/gpt-5
/model mistral/mistral-large-latest
/model xai/grok-3
```

Bifrost supports [23+ providers](https://docs.getbifrost.ai/providers/supported-providers/overview) including OpenAI, Azure, Google (Gemini and Vertex), AWS Bedrock, Mistral, Groq, Cerebras, Cohere, xAI, Ollama, and more.

## Tool Use Compatibility: What to Know

One critical requirement when routing Claude Code to non-Anthropic models: the alternative model must support tool use capabilities. Claude Code relies heavily on [tool calling](https://docs.anthropic.com/en/docs/build-with-claude/tool-use) for its core operations, including file edits, terminal commands, and code generation workflows. Models without proper tool use support will fail on these operations.

Additionally, Claude-specific features like extended thinking, web search, and computer use are not available when using non-Anthropic models. Core functionality (chat, streaming, and tool use) works across most providers.

It is also worth noting that some proxy providers may not handle streaming correctly. Bifrost's documentation flags that providers like OpenRouter may not stream function call arguments properly, which can cause tool calls to return with empty arguments. If you encounter this, switching to a direct provider in your [Bifrost configuration](https://docs.getbifrost.ai/quickstart/gateway/provider-configuration) resolves the issue.

## Production Benefits Beyond Model Switching

Routing Claude Code through Bifrost is not just about swapping models. It opens up enterprise-grade infrastructure capabilities:

- **Automatic failover**: If your primary provider goes down or returns errors, Bifrost [reroutes traffic to a configured fallback](https://docs.getbifrost.ai/features/fallbacks) automatically
- **Observability**: Every request gets logged with token usage, latency, and full request/response data. The built-in dashboard provides real-time visibility, with [Prometheus metrics and OpenTelemetry support](https://docs.getbifrost.ai/features/observability) for production monitoring
- **Governance and cost control**: [Virtual keys](https://docs.getbifrost.ai/features/governance/virtual-keys) enable per-developer budgets, rate limiting, and access control, preventing runaway costs across teams
- **MCP tool injection**: [MCP tools](https://docs.getbifrost.ai/mcp/overview) configured in Bifrost automatically become available to Claude Code. Bifrost injects tools into the request's tools array before forwarding, so Claude Code can use filesystem tools, web search, or database queries without client-side configuration. MCP code mode reduces token usage by 50%+ when using multiple MCP servers.
- **Semantic caching**: [Semantic caching](https://docs.getbifrost.ai/features/semantic-caching) matches requests by meaning rather than exact text, reducing redundant API calls and delivering sub-millisecond cache retrieval

## Getting Started with Bifrost CLI

Setup takes under a minute. Install and run the Bifrost gateway locally:

```bash
npx @anthropic-ai/bifrost-cli
```

Then launch Bifrost CLI, select Claude Code as your harness, choose your model, and start coding. The [Bifrost GitHub repository](https://github.com/maximhq/bifrost) contains full documentation and configuration guides.

For teams evaluating Bifrost for production Claude Code deployments at scale, [book a demo](https://www.getmaxim.ai/book-a-demo) to explore enterprise features like clustering, guardrails, vault support, and in-VPC deployments.

## Read next

[![LLM Routing: How Routing Decisions Get Made](https://storage.ghost.io/c/84/03/8403f2f6-141c-411a-8f55-a32d4291533e/content/images/size/w720/2026/10/llm-routing-how-routing-decisions-get-made-bifrost-1920x1080-1.png) LLM routing is the per-request choice of which provider, model, and API key serve an LLM call. This guide walks through the signals a router evaluates, the precedence order Bifrost applies, what happens when a route fails, and how to debug a routing decision from its logs.](https://www.getmaxim.ai/articles/llm-routing-decisions/)

[![How to Deploy an LLM Stack in an Air-Gapped Environment](https://storage.ghost.io/c/84/03/8403f2f6-141c-411a-8f55-a32d4291533e/content/images/size/w720/2026/10/how-to-deploy-an-llm-stack-in-an-air-gapped-environment-bifrost-1920x1080.png) An air-gapped environment has no automated connection to the internet, so every model, image, and update arrives by controlled transfer. This guide walks through each layer of an offline LLM stack, from model serving with vLLM and SGLang to gateway policy, guardrails, identity, and audit logs.](https://www.getmaxim.ai/articles/llm-stack-air-gapped-environment/)

[![GPT Realtime API in Production: Routing, Governing and Billing Voice Sessions](https://storage.ghost.io/c/84/03/8403f2f6-141c-411a-8f55-a32d4291533e/content/images/size/w720/2026/10/gpt-realtime-api-in-production-routing-governing-and-billing-bifrost-1920x1080.png) GPT Realtime is OpenAI's speech-to-speech model family on the Realtime API, with GPT-Live as its duration-billed sibling. This guide covers connections, client secrets and billing, then shows how Bifrost routes, governs and prices every voice session.](https://www.getmaxim.ai/articles/gpt-realtime-api-production/)

## More in AI Gateway

[![Best Enterprise AI Gateway for Fintech Organisations in 2026](https://storage.ghost.io/c/84/03/8403f2f6-141c-411a-8f55-a32d4291533e/content/images/size/w720/2026/07/best-enterprise-ai-gateway-for-fintech-organisations-in-2026-bifrost-circuit.optimized.png) Fintech companies are deploying AI across fraud detection, credit scoring, KYC automation, customer service, and regulatory compliance. McKinsey estimates AI could add $200 to $340 billion in annual value to the global banking industry. But unlike consumer applications where a hallucinated response is merely inconvenient, a wrong answer in financial](https://www.getmaxim.ai/articles/best-enterprise-ai-gateway-for-fintech-organisations-in-2026/)

[![Top 5 Enterprise LLM Gateways in 2026](https://storage.ghost.io/c/84/03/8403f2f6-141c-411a-8f55-a32d4291533e/content/images/size/w720/2026/07/top-5-enterprise-llm-gateways-in-2026-bifrost-weave.optimized.png) TL;DR: Compare the top enterprise LLM gateways in 2026 for performance, governance, failover, and multi-provider routing at production scale. Enterprise AI teams in 2026 manage requests across multiple LLM providers simultaneously. A single application might route to OpenAI for conversational tasks, Anthropic for coding, and Google Gemini for](https://www.getmaxim.ai/articles/top-5-enterprise-llm-gateways-in-2026/)

```json
{
    "@context": "https://schema.org",
    "@type": "Article",
    "publisher": {
        "@type": "Organization",
        "name": "Maxim Articles",
        "url": "https://www.getmaxim.ai/articles/",
        "logo": {
            "@type": "ImageObject",
            "url": "https://storage.ghost.io/c/84/03/8403f2f6-141c-411a-8f55-a32d4291533e/content/images/size/w256h256/2025/08/thumbnail.png",
            "width": 60,
            "height": 60
        }
    },
    "author": {
        "@type": "Person",
        "name": "Kamya Shah",
        "image": {
            "@type": "ImageObject",
            "url": "https://storage.ghost.io/c/84/03/8403f2f6-141c-411a-8f55-a32d4291533e/content/images/2025/09/WhatsApp-Image-2025-08-29-at-17.40.40-1.jpeg",
            "width": 1200,
            "height": 1600
        },
        "url": "https://www.getmaxim.ai/articles/author/kamya/",
        "sameAs": []
    },
    "headline": "Running Claude Code with Non-Anthropic Models Using Bifrost CLI",
    "url": "https://www.getmaxim.ai/articles/running-claude-code-with-non-anthropic-models-using-bifrost-cli/",
    "datePublished": "2026-03-31T17:58:00.000Z",
    "dateModified": "2026-10-13T11:03:26.000Z",
    "image": {
        "@type": "ImageObject",
        "url": "https://storage.ghost.io/c/84/03/8403f2f6-141c-411a-8f55-a32d4291533e/content/images/size/w1200/2026/07/running-claude-code-with-non-anthropic-models-using-bifrost--bifrost-weave.optimized.png",
        "width": 1200,
        "height": 630
    },
    "keywords": "AI Gateway",
    "description": "Bifrost CLI lets you run Claude Code with models from OpenAI, Google, Mistral, and 23+ providers through a single command. No client modifications required.\n\nClaude Code is one of the most capable terminal-based AI coding agents available today. It handles file operations, runs terminal commands, edits code, and reasons through complex engineering tasks directly from the command line. But it ships with a hard constraint: Claude Code only works with Anthropic's models out of the box. For engineer",
    "mainEntityOfPage": "https://www.getmaxim.ai/articles/running-claude-code-with-non-anthropic-models-using-bifrost-cli/"
}
```
