---
title: "CLI Coding Agents + Bifrost | Claude Code, Codex, Gemini, OpenCode"
description: "Run Claude Code, Codex CLI, Gemini CLI, and OpenCode through Bifrost for multi-provider routing, enterprise controls, cost tracking, and centralized observability."
url: "https://www.getmaxim.ai/bifrost/resources/cli-agents"
markdown: "https://www.getmaxim.ai/bifrost/resources/cli-agents.md"
---

# CLI Coding Agents + Bifrost | Claude Code, Codex, Gemini, OpenCode

> Run Claude Code, Codex CLI, Gemini CLI, and OpenCode through Bifrost for multi-provider routing, enterprise controls, cost tracking, and centralized observability.

## Important Links

- [View MCP Gateway](https://www.getmaxim.ai/bifrost/resources/mcp-gateway.md)
- [Features](https://www.getmaxim.ai/bifrost/#features)
- [Enterprise](https://www.getmaxim.ai/bifrost/enterprise)
- [Pricing](https://www.getmaxim.ai/bifrost/pricing.md)
- [Docs](https://docs.getbifrost.ai)
- [GitHub](https://github.com/maximhq/bifrost)
- [Book a Demo](https://www.getmaxim.ai/bifrost/book-a-demo)

## Supported CLI Agents

Each CLI agent brings unique capabilities. Bifrost provides the enterprise controls, multi-provider access, and observability that all of them need at scale.

- **Provider: Anthropic - Claude Code:** Official CLI Agent for Anthropic Models.
- **Provider: OpenAI - Codex CLI:** OpenAI's powerful code generation CLI.
- **Provider: Google - Gemini CLI:** Google Gemini powered coding agent.
- **Provider: Multi-provider - OpenCode:** Open source coding agent framework.

## Core Capabilities

- **1000+ models - Multi-provider model access:** Every CLI agent gets access to 1000+ models through Bifrost. Switch between Anthropic, OpenAI, Google, AWS Bedrock, and more without reconfiguring your agent.
- **SOC 2 Type II ready - Enterprise security & governance:** All agent requests route through Bifrost, applying guardrails, PII redaction, content policies, and role-based access controls transparently.
- **Per-request costs - Unified cost tracking:** Track LLM spend across all CLI agents from a single dashboard. Virtual keys enforce per-team budgets. Export via the logs API or OTEL for custom cost analysis.
- **OTEL native - Centralized observability:** Every request from Claude Code, Codex CLI, Gemini CLI, and OpenCode is logged with full metadata. Export to any observability stack via OpenTelemetry.
- **99.999% uptime - Automatic failover & load balancing:** When a provider hits rate limits or experiences an outage, Bifrost automatically routes agent requests to healthy providers. Adaptive load balancing keeps throughput stable.
- **Cost savings - Semantic caching:** Repeat or near-identical queries across agents resolve instantly from cache, cutting costs and reducing latency for common coding operations.

## Setup Steps

1. **01 - Deploy Bifrost Gateway.** Run Bifrost as a standalone service in your VPC or use managed hosting. Configure your LLM providers and optional guardrails through the dashboard.

### Deploy Bifrost Gateway

```
# pull and start bifrost
docker pull bifrost-gateway
docker run -p 8080:8080 bifrost
```

2. **02 - Point your CLI agent at Bifrost.** Set the API base URL environment variable for your chosen agent. Each agent has slightly different configuration requirements.

### Point your CLI agent at Bifrost

```
# Claude Code
export ANTHROPIC_BASE_URL="http://localhost:8080"

# Codex CLI (must end in /v1)
export OPENAI_API_BASE="http://localhost:8080/openai/v1"

# Gemini CLI
export GEMINI_API_BASE="http://localhost:8080"

# OpenCode
export API_BASE_URL="http://localhost:8080"
```

3. **03 - Start coding with enterprise controls.** Launch your agent and start coding. All requests automatically route through Bifrost with full observability, cost tracking, and guardrails applied.

### Start coding with enterprise controls

```
# Use Bifrost CLI for guided setup
npx -y @maximhq/bifrost-cli

# Or launch agents directly
claude code
codex generate
gemini chat
opencode
```

## Comparison Data

| Feature | Standalone | With Bifrost |
| --- | --- | --- |
| Multi-provider access | No | 20+ providers |
| Automatic failover | No | Across all providers |
| Cost tracking | No | Real-time per request |
| Team budgets | No | Virtual keys + limits |
| Security guardrails | No | PII redaction + policies |
| Request observability | No | Full logs + OTEL export |
| Semantic caching | No | Reduce costs + latency |
| MCP tool integration | Claude Code only | All agents via gateway |

## Use Cases

- **Multi-agent development workflows:** Teams use different CLI agents for different tasks: Claude Code for architecture, Codex for quick scripts, Gemini for code review, OpenCode for deployments. Bifrost provides unified governance.
- **Model performance comparison:** Run the same coding task through Claude Code, Codex CLI, and Gemini CLI to compare quality, speed, and cost. Bifrost logs performance metrics for each provider.
- **Enterprise security compliance:** Organizations route all CLI agent traffic through Bifrost to enforce PII redaction, content policies, and audit trails for SOC 2 Type II, HIPAA, and GDPR compliance.
- **Department-level cost management:** Platform teams set budgets for each engineering department. Real-time dashboards show which teams, projects, and agents are driving LLM spend.
- **High-availability production coding:** When Anthropic hits rate limits, Claude Code requests automatically route to Bedrock. When OpenAI hits rate limits or errors, Codex CLI switches to Azure OpenAI.
- **Centralized AI governance:** Security teams enforce organization-wide policies across all CLI agents from a single control plane. No need to configure guardrails per agent.

## Enterprise Features

- **Virtual keys per team:** Create separate credentials for each team with independent rate limits and budgets.
- **Content filtering:** Detect and redact PII, sensitive data, and API keys before requests reach models.
- **Audit trails:** Complete tamper-evident logs of every request for compliance and security.
- **SSO integration:** Authenticate via Google, GitHub, Okta, or any SAML/OIDC provider.
- **Adaptive routing:** Traffic distributes intelligently based on real-time health and performance.
- **In-VPC deployment:** Deploy entirely within your network perimeter for maximum security.

## Features

### OSS Features

- **01 - Model Catalog:** Access 8+ providers and 1000+ AI models through a unified interface. Also supports custom deployed models.
- **02 - Budgeting:** Set spending limits and track costs across teams, projects, and models.
- **03 - Provider Fallback:** Automatic failover between providers ensures 99.99% uptime for your applications.
- **04 - MCP Gateway:** Centralize all MCP tool connections, governance, security, and auth. Your AI can safely use MCP tools with centralized policy enforcement. [MCP Gateway resource](https://www.getmaxim.ai/bifrost/resources/mcp-gateway.md).
- **05 - Virtual Key Management:** Create different virtual keys for different use cases with independent budgets and access control.
- **06 - Unified Interface:** One consistent API for all providers. Switch models without changing code.
- **07 - Drop-in Replacement:** Replace your existing SDK with just one line change. Compatible with OpenAI, Anthropic, LiteLLM, Google GenAI, LangChain, and more. [Drop-in replacement docs](https://docs.getbifrost.ai/features/drop-in-replacement).
- **08 - Built-in Observability:** Out-of-the-box OpenTelemetry support. Built-in dashboard for quick visibility without complex setup.
- **09 - Community Support:** Active Discord community with responsive support and regular updates.

### Enterprise Features

- **01 - Governance:** SAML support for SSO and role-based access control with policy enforcement for team collaboration. [Governance resource](https://www.getmaxim.ai/bifrost/resources/governance.md).
- **02 - Adaptive Load Balancing:** Automatically optimizes traffic distribution across provider keys and models based on real-time performance metrics.
- **03 - Cluster Mode:** High availability deployment with automatic failover and load balancing. Peer-to-peer clustering where every instance is equal.
- **04 - Alerts:** Real-time notifications for budget limits, failures, and performance issues on Email, Slack, PagerDuty, Teams, Webhook, and more.
- **05 - Log Exports:** Export and analyze request logs, traces, and telemetry data from Bifrost with enterprise-grade data export for compliance, monitoring, and analytics.
- **06 - Audit Logs:** Comprehensive logging and audit trails for compliance and debugging.
- **07 - Vault Support:** Secure API key management with HashiCorp Vault, AWS Secrets Manager, Google Secret Manager, and Azure Key Vault integration.
- **08 - VPC Deployment:** Deploy Bifrost within your private cloud infrastructure with VPC isolation, custom networking, and enhanced security controls. [Enterprise deployment resource](https://www.getmaxim.ai/bifrost/resources/enterprise-deployment.md).
- **09 - Guardrails:** Automatically detect and block unsafe model outputs with real-time policy enforcement and content moderation across all agents. [Guardrails resource](https://www.getmaxim.ai/bifrost/resources/guardrails.md).

## FAQ

### Can I use multiple CLI agents with the same Bifrost gateway?

Yes. Bifrost provides compatible endpoints for OpenAI, Anthropic, and Gemini-style APIs, allowing you to route Claude Code, Codex CLI, Gemini CLI, and OpenCode through the same gateway simultaneously. Each agent gets access to configured providers. Read more about Bifrost CLI. [Read more about Bifrost CLI](https://docs.getbifrost.ai/quickstart/cli/getting-started).

### How do I switch models or providers for a specific CLI agent?

You can configure model routing through Bifrost virtual keys, which specify which models each key can access. Alternatively, use Bifrost CLI (npx @maximhq/bifrost-cli) for guided setup that lets you select models before launching agents. The gateway handles provider routing automatically.

### Does routing CLI agents through Bifrost add latency?

Bifrost adds approximately 11µs of gateway overhead per request at 5,000 RPS in the published t3.xlarge benchmark. Read the benchmark page for test conditions. [Bifrost benchmarks](https://www.getmaxim.ai/bifrost/resources/benchmarks.md).

### Can I use MCP tools with all CLI agents through Bifrost?

Claude Code has native MCP support that integrates directly with Bifrost MCP endpoints. Other agents can access MCP-connected tools through Bifrost's gateway, though the integration may vary by agent. The Bifrost CLI automatically registers MCP servers for Claude Code.

### How are costs tracked across different CLI agents?

Bifrost logs every request with model, provider, token counts, and cost. Use virtual keys to tag requests by agent, team, or environment. Export via the logs API or OTEL to build cost breakdowns in your BI tool of choice.

### What happens if one provider goes down while using CLI agents?

Bifrost automatically fails over to configured healthy providers. If the primary provider for an agent hits rate limits or errors, requests can route to fallback providers according to your gateway policy.

## Related Resources

- [Source: CLI Agents](https://www.getmaxim.ai/bifrost/resources/cli-agents.md)
- [Docs: Bifrost docs](https://docs.getbifrost.ai)
- [GitHub: maximhq/bifrost](https://github.com/maximhq/bifrost)
- [Pricing: Bifrost pricing](https://www.getmaxim.ai/bifrost/pricing.md)
- [Enterprise: Bifrost enterprise](https://www.getmaxim.ai/bifrost/enterprise)
- [Book a Demo: Bifrost demo](https://www.getmaxim.ai/bifrost/book-a-demo)
- [Resources: Bifrost resources](https://www.getmaxim.ai/bifrost/resources.md)

---

*This is a markdown version of [https://www.getmaxim.ai/bifrost/resources/cli-agents](https://www.getmaxim.ai/bifrost/resources/cli-agents) for AI/LLM consumption.*
