One Bifrost CLI command launches Claude Code, Codex CLI, Gemini CLI, and Opencode. No environment variables, MCP tools attached automatically, every model in one place.
Coding agents like Claude Code get wired into your Bifrost AI gateway by a single command when you use the Bifrost CLI. Rather than hand-editing base URLs, rotating API keys between providers, and touching each agent's own config file, engineers just type bifrost in a terminal, pick which agent they want, pick a model, and get to work. This guide covers how the Bifrost CLI works with Claude Code and every other supported coding agent, starting with gateway setup and moving through features like tabbed sessions, git worktrees, and automatic MCP attach.
Engineering teams now lean on coding agents as a default part of how they ship. Anthropic states that the majority of code at Anthropic is now written by Claude Code, and its engineers increasingly spend their time on architecture, code review, and orchestration instead of writing every line themselves. As the number of agents in daily use grows (Claude Code for large refactors, Codex CLI for quick fixes, Gemini CLI for specific models), configuration overhead stacks up fast. That overhead is what the Bifrost CLI is designed to eliminate, collapsing multiple agent-specific setups into one launcher.
What the Bifrost CLI Actually Does
The Bifrost CLI is an interactive terminal launcher that fronts every supported coding agent with your Bifrost gateway. Provider setup, model picking, API key injection, and MCP auto-attach all happen under the hood. Bifrost itself is the open-source AI gateway by Maxim AI, giving teams unified access to 20+ LLM providers behind one OpenAI-compatible API with just 11 microseconds of overhead at 5,000 requests per second.
Four coding agents are supported out of the box today:
-
Claude Code (binary:
claude, provider path:/anthropic), with automatic MCP attach and git worktree support -
Codex CLI (binary:
codex, provider path:/openai), whereOPENAI_BASE_URLis pointed at{base}/openai/v1and the model is passed via-model -
Gemini CLI (binary:
gemini, provider path:/genai), with model override through-model -
Opencode (binary:
opencode, provider path:/openai), using a generated Opencode runtime config to load custom models
Per-agent integration specifics live in the CLI agents documentation. For a broader view of how Bifrost fits into terminal-first developer workflows, the CLI coding agents resource page walks through the full set of supported agents and integration patterns.
Why Run Coding Agents Through Bifrost
Putting Claude Code and every other coding agent behind Bifrost gives an engineering org three concrete wins: one entry point for every model, centralized governance over agent spend, and a shared MCP tool layer. Instead of each engineer wiring API keys into their own agent and each agent carrying its own tool config, Bifrost becomes the single control plane.
One Interface to Every Model
By default Claude Code runs on Claude Opus and Sonnet, but teams frequently want more flexibility. Certain tasks map better to GPT-4o from OpenAI or a Gemini model from Google, whether for language coverage, framework compatibility, or cost. When you launch Claude Code through the Bifrost CLI, it talks to Bifrost's OpenAI-compatible API, which means any of the 20+ providers Bifrost covers (OpenAI, Anthropic, AWS Bedrock, Google Vertex AI, Azure OpenAI, Gemini, Groq, Mistral, Cohere, Cerebras, Ollama, and others) can sit behind your coding agent. This is possible because of Bifrost's drop-in replacement design: the agent believes it is calling OpenAI or Anthropic directly, and Bifrost handles the routing behind that illusion.
Governance and Spend Control
Token budgets go fast when coding agents are in play. A single multi-file refactor inside Claude Code can chew through hundreds of thousands of tokens, and usage scales roughly linearly with the size of your team. Bifrost governance treats virtual keys as the primary governance entity, which lets you set budgets, rate limits, and model access permissions per engineer or per team. Senior engineers can be permitted to run expensive reasoning models, while more junior ones default to cost-efficient options. Every token gets attributed, shows up in dashboards, and stays within virtual-key budgets. For the full enterprise picture, the enterprise governance resource page goes through the governance model in depth.
Shared MCP Tools Across the Team
MCP tools add real leverage to every coding agent (filesystem access, database queries, GitHub integration, docs lookup, internal APIs), but configuring MCP servers separately inside each agent for each engineer is tedious. Bifrost's MCP gateway puts that configuration in one place. When the Bifrost CLI fires up Claude Code, Bifrost's MCP endpoint is attached automatically, so every tool configured in Bifrost is immediately usable in the agent, no claude mcp add-json calls or hand-edited JSON files required. Teams that are standardizing on MCP for internal tools and data access feel this the most. For more detail on how that architecture compounds into token savings, read Bifrost MCP Gateway access control, cost governance, and 92% lower token costs.
Prerequisite: A Running Bifrost Gateway
You need a running Bifrost gateway for the CLI to connect to. Starting one takes zero configuration:
npx -y @maximhq/bifrost
By default the gateway comes up on http://localhost:8080. Opening that URL in a browser gives you the web UI for adding providers, setting up virtual keys, and turning on features like semantic caching or observability. Docker works equally well:
docker pull maximhq/bifrost
docker run -p 8080:8080 -v $(pwd)/data:/app/data maximhq/bifrost
The -v $(pwd)/data:/app/data flag mounts persistent storage so your configuration survives container restarts. For more advanced setup (different ports, log levels, file-based config, PostgreSQL-backed persistence), every flag and mode is documented in the gateway setup guide.
Once at least one provider is configured in the gateway, the CLI is ready to launch.
Installing the Bifrost CLI
The Bifrost CLI runs on Node.js 18+ and installs via npx:
npx -y @maximhq/bifrost-cli
After that first run the bifrost binary is on your path:
bifrost
If you need to pin a specific CLI version:
npx -y @maximhq/bifrost-cli --cli-version v1.0.0
Starting a Claude Code Session via the Bifrost CLI
Typing bifrost drops you into an interactive TUI that walks through five setup steps:
-
Base URL: Point the CLI at your Bifrost gateway (usually
http://localhost:8080in local dev). - Virtual Key (optional): If virtual key authentication is on, enter your key here. Virtual keys get written to your OS keyring (macOS Keychain, Windows Credential Manager, Linux Secret Service), not to plaintext files on disk.
- Choose a Harness: Pick Claude Code from the list. The CLI reports install status and version. If Claude Code is missing, it offers to install the binary via npm for you.
-
Select a Model: The CLI hits your gateway's
/v1/modelsendpoint and shows a searchable list of available models. Type to filter, arrow through the list, or paste in any model ID manually (for instance,anthropic/claude-sonnet-4-5-20250929). - Launch: Check the configuration summary and hit Enter.
From there the CLI handles every required environment variable, applies the provider-specific config, and starts Claude Code right in your current terminal. You are now inside Claude Code as usual, except every request is flowing through Bifrost.
MCP Auto-Attach for Claude Code
Whenever Claude Code starts through the Bifrost CLI, the CLI registers Bifrost's MCP endpoint at /mcp automatically, making all your configured MCP tools available from inside Claude Code. When a virtual key is in use, the CLI also configures authenticated MCP access with the proper Authorization header. No claude mcp add-json invocations are needed on your end. For the other harnesses (Codex CLI, Gemini CLI, Opencode), the CLI prints out the MCP server URL and you wire it into the agent's settings manually. Teams going deeper on this workflow can review Bifrost's Claude Code integration resources for provider failover, cost tracking, and MCP attach patterns.
The Tabbed Session Interface
Rather than exiting when a session ends, the Bifrost CLI keeps you inside a tabbed terminal UI. A tab bar at the bottom shows the CLI version, one tab for each running or recent agent session, and a status badge on each tab:
- 🧠means the session is changing right now (the agent is actively working)
- ✅ means the session is idle and waiting
- 🔔 means the session raised an actual terminal alert
Hitting Ctrl+B focuses the tab bar at any time. Once there:
-
nspawns a new tab and launches another agent session -
xcloses the current tab -
h/lnavigate left and right between tabs -
19jump straight to a tab by number -
Esc/Enter/Ctrl+Btake you back to the active session
This pays off when you want to flip between Claude Code on one task and Gemini CLI on another, or run two Claude Code sessions in parallel against separate branches.
Git Worktrees with Claude Code
Worktree support ships for Claude Code, which lets sessions run in isolated git worktrees so parallel development stays clean:
npx -y @maximhq/bifrost-cli -worktree feature-branch
The TUI also exposes worktree mode during setup. Under the hood the CLI passes the --worktree flag through to Claude Code, which spins up a fresh working directory on the specified branch. That enables patterns like running two Claude Code agents at once, one on main and one on a feature branch, with no file conflicts between them.
Configuration File and CLI Flags
CLI configuration persists at ~/.bifrost/config.json. The file gets created on first run and updates as you make changes in the TUI:
{
"base_url": "http://localhost:8080",
"default_harness": "claude",
"default_model": "anthropic/claude-sonnet-4-5-20250929"
}
Virtual keys are not written to this file, they live in your OS keyring.
Flags the CLI accepts:
-
config <path>: Load a customconfig.json(handy for per-project gateway setups) -
no-resume: Skip the resume flow and start a fresh setup -
worktree <n>: Spin up a git worktree for the session (Claude Code only)
From the summary screen, shortcut keys let you change settings without restarting:
-
uswaps the base URL -
vupdates the virtual key -
hmoves to a different harness -
mpicks a different model -
wsets a worktree name (Claude Code only) -
dopens the Bifrost dashboard in the browser -
ltoggles harness exit logs
Jumping Between Coding Agents
The real value of the Bifrost CLI shows up when you want to switch agents quickly. Ending a Claude Code session lands you back at the summary screen with your previous configuration still in place. Tap h to swap Claude Code for Codex CLI, tap m to try GPT-4o instead of Claude Sonnet, then hit Enter to relaunch. Base URLs, API keys, model flags, agent-specific settings: the CLI reconfigures all of it on your behalf.
Opencode gets two extra behaviors: the CLI produces a provider-qualified model reference and a runtime config so Opencode comes up with the correct model, and it keeps whatever theme is already defined in your tui.json, falling back to the adaptive system theme when nothing is set.
Workflows That Show Up in Practice
A handful of patterns keep appearing among teams running the Bifrost CLI with coding agents:
- Side-by-side agent comparison: An engineer opens a tab with Claude Code on a task, opens a second tab with Codex CLI on the same task, and compares the outputs. Because traffic all flows through Bifrost, each request is logged and tied back to the same virtual key.
- Worktree-driven parallel work: A single engineer runs Claude Code against a bug fix in one worktree and another Claude Code session against a feature in a different worktree, with both tabs visible at once.
- Different models for different tasks: Claude Opus takes the heavy architectural refactors, Gemini covers documentation-heavy work, and a local Ollama model picks up the small edits. None of that requires leaving the CLI or redoing config.
- Team-wide MCP tool sharing: Platform engineers wire MCP servers up once inside the Bifrost dashboard (filesystem access, internal APIs, database tools), and every engineer's Claude Code session picks those tools up automatically.
Fixing Common Problems
A few snags come up regularly:
-
"npm not found in path": The CLI relies on npm to install missing harnesses. Make sure Node.js 18+ is installed and
npm --versionresolves cleanly. -
Agent binary not found after install: Either restart your terminal or put npm's global bin on your
PATHwithexport PATH="$(npm config get prefix)/bin:$PATH". - Model list empty: Check that your Bifrost gateway answers at the configured base URL, confirm at least one provider is set up, and (if virtual keys are on) verify your key is permitted to list models.
-
Virtual key getting dropped between sessions: OS keyring storage is what preserves it. On Linux, make sure
gnome-keyringorkwalletis active. If the keyring is unreachable, the CLI logs a warning and keeps running, but you'll re-enter the key each session.
Getting Up and Running with the Bifrost CLI
The Bifrost CLI makes every coding agent a first-class citizen of your AI gateway. Engineers stop wrestling with environment variables and per-agent config files, and platform teams get centralized governance, observability, and MCP tool management spanning every agent their org uses. Claude Code, Codex CLI, Gemini CLI, and Opencode all route through one launcher, one credential set, and one dashboard.
To begin using the Bifrost CLI with Claude Code or any other supported coding agent, bring up a gateway with npx -y @maximhq/bifrost, install the CLI with npx -y @maximhq/bifrost-cli, and walk through the setup. Teams looking at Bifrost for production coding agent workflows can book a demo with the Bifrost team to see how the CLI, MCP gateway, and governance layer work together at scale.
Top comments (0)