DEV Community

Cover image for Bifrost CLI + Codex CLI: One Command to Set Up OpenAI's Coding Agent with Any Model
Anthony Max
Anthony Max Subscriber

Posted on

Bifrost CLI + Codex CLI: One Command to Set Up OpenAI's Coding Agent with Any Model

Tired of manually configuring API keys, and provider paths every time you launch a coding agent? Bifrost CLI solves this with a single command.

Launch Codex CLI (or Claude Code, Opencode) through your Bifrost gateway with no configuration. The CLI handles everything automatically: base URLs, API keys, model selection, and MCP integration.

cli


👀 1. What is Bifrost CLI?

Bifrost CLI is an interactive terminal tool that connects your favorite coding agents to your Bifrost gateway. Instead of environment variables and config files, you just run a command and pick your agent, model, and go.

npx -y @maximhq/bifrost-cli
Enter fullscreen mode Exit fullscreen mode

What it does for you:

  • ✅ Automatically configures base URLs, API keys, and model settings
  • ✅ Fetches available models from your Bifrost gateway
  • ✅ Installs missing agents via npm if needed
  • ✅ Auto-attaches Bifrost's MCP server for tool access
  • ✅ Launches agents in a tabbed terminal UI
  • ✅ Stores your selections securely in OS keyring

Supported agents:

  • Claude Code (with MCP auto-attach)
  • Codex CLI (OpenAI's coding agent)
  • Gemini CLI (Google's agent)
  • Opencode (Custom models support)

💎 Star Bifrost ☆


⚙️ 2. Getting Started in 3 Easy Steps

It takes only 5 minutes to use the CLI.

Step 1: Start Bifrost Gateway

Make sure your Bifrost gateway is running:

npx -y @maximhq/bifrost -p 8000
# Gateway starts at http://localhost:8000
Enter fullscreen mode Exit fullscreen mode

Step 2: Launch Bifrost CLI

In another terminal:

npx -y @maximhq/bifrost-cli
Enter fullscreen mode Exit fullscreen mode

Step 3: Follow the Interactive Setup

The CLI guides you through:

  1. Base URL — Enter your Bifrost gateway URL
  2. Virtual Key (optional) — If you have authentication enabled
  3. Choose Agent — Pick Codex, Claude Code, Gemini, or Opencode
  4. Select Model — Searchable list of available models from your gateway
  5. Review & Launch — Press Enter to start

That's it. Your agent launches with everything configured automatically.


🔎 3. How It Works: Configuration Magic

Bifrost CLI stores configuration automatically:

{
  "base_url": "http://localhost:8000",
  "default_harness": "codex",
  "default_model": "openai/gpt-4o"
}
Enter fullscreen mode Exit fullscreen mode

The magic:

  • Base URL and API keys are fetched from your Bifrost gateway
  • Your Codex CLI gets the correct provider path (/openai)
  • Model selection happens from available models in the gateway
  • Virtual keys are stored securely in OS keyring (never plaintext)

Switch agents anytime:

Press Ctrl+B to open the tab bar. Then:

h — Switch to different agent (Claude Code, Codex, Gemini, Opencode)
m — Pick different model
Enter — Launch
Enter fullscreen mode Exit fullscreen mode

and more.

No environment variables. No config editing. Just shortcuts.


🔗 4. Tabbed Sessions & MCP Integration

After launch, you stay in a persistent tabbed terminal UI. Switch between sessions without re-running the CLI:

Ctrl+B — Open tab bar
n — New session
x — Close current tab
h/l — Navigate tabs
1-9 — Jump to specific tab
Enter fullscreen mode Exit fullscreen mode

Status badges:

  • Agent is working
  • Session idle and ready
  • Terminal alert

For Codex CLI specifically:

  • MCP server auto-configured for Bifrost
  • Access to all your configured tools through the gateway
  • Automatic provider path routing (/openai)

The session flow is seamless:

Launch → Work → Switch Sessions → Return → Re-launch
Enter fullscreen mode Exit fullscreen mode

Your last selections are remembered. Next time you run bifrost, you'll see the summary screen with your previous configuration ready.


✅ 5. Advanced Features

Custom config path:

npx -y @maximhq/bifrost-cli -config ./my-project/bifrost.json
Enter fullscreen mode Exit fullscreen mode

Useful for multiple Bifrost gateways or project-specific setups.

Available flags:

-config <path>    # Custom config file location
-no-resume        # Skip resume flow, start fresh setup
-worktree <name>  # Create git worktree (Claude Code only)
Enter fullscreen mode Exit fullscreen mode

Keyboard shortcuts during setup:

Enter — Launch with current settings
r — Open documentation
l — Toggle harness exit logs
Enter fullscreen mode Exit fullscreen mode

and more.

Example: Launch with custom worktree

npx -y @maximhq/bifrost-cli -worktree feature-branch
Enter fullscreen mode Exit fullscreen mode

This launches Claude Code in an isolated git worktree for parallel development.


📦 Installation & Requirements

Bifrost CLI requires:

  • Node.js 18+ (for npx)
  • A running Bifrost gateway
# First time
npx -y @maximhq/bifrost-cli

# If installed, just run
bifrost
Enter fullscreen mode Exit fullscreen mode

💻 Results

Before Bifrost CLI:

  • ❌ Set OPENAI_API_KEY manually
  • ❌ Edit config files with provider paths
  • ❌ Manage API keys in plaintext
  • ❌ Switch agents = reconfigure everything
  • ❌ No centralized model management

After Bifrost CLI:

  • ✅ One command: bifrost
  • ✅ Everything auto-configured
  • ✅ Keys stored securely in OS keyring
  • ✅ Switch agents with one shortcut
  • ✅ Models fetched from gateway
  • ✅ MCP integration automatic
  • ✅ Persistent tabbed sessions

For Codex CLI users, this means instant access to OpenAI's powerful coding agent with Bifrost's routing, control, and MCP tools — all from one command.


🔎 Quick Reference

# Start Bifrost gateway
npx -y @maximhq/bifrost

# Launch CLI (in another terminal)
npx -y @maximhq/bifrost-cli

# Follow interactive setup
# Select: Codex CLI → Model → Launch

# Once running, use Ctrl+B to switch sessions
Enter fullscreen mode Exit fullscreen mode

🖋 Conclusion

Bifrost CLI eliminates the friction of coding agent setup no more config files, or manual key management. One command
(npx -y @maximhq/bifrost-cli) launches your agent with everything automatically
configured and secure. Stop configuring, start building.


Resources:

Top comments (3)

Collapse
 
anthonymax profile image
Anthony Max

How do you like the new Bifrost CLI?

Collapse
 
alexjohn_21 profile image
alexjohn_21

Interesting CLI

Collapse
 
anthonymax profile image
Anthony Max

100%