---
last_updated: 2026-09-30
source_url: https://opper.ai/agent-cli
title: "Claude Code, OpenCode & Codex CLI router | Opper Agent CLI"
description: "A CLI router for Claude Code, Codex, OpenCode, Hermes, Pi, and OpenClaw. Run any AI agent on any model through Opper's gateway. One key, 700+ models."
---

# Opper Agent CLI

> Run Claude Code, Codex, and more on any model. A CLI router for AI coding agents — install once, log in once, then `opper launch <agent>` to launch any supported agent on Opper's gateway with EU-hosted models, automatic fallbacks, and pay-as-you-go inference.

## What it is

The Opper Agent CLI (`@opperai/cli`) is a single command-line tool that wires popular AI coding agents into Opper's `/v3/compat` gateway. Developers install one CLI, authenticate once via OAuth, and then launch **Claude Code, Codex, OpenCode, OpenClaw, Hermes, or Pi** with a single command — all routed through one Opper API key, billed at provider rates with no markup, with a 3% fee on credit top-ups.

**Why it exists.** Each AI coding agent normally needs its own provider keys (OpenAI, Anthropic, etc.), separate billing, and per-agent rate-limit handling. The Agent CLI consolidates that: one key, one bill, 700+ models, full observability, and the ability to swap the model behind any agent at runtime.

## How it works — three steps

1. **Run the CLI** — `npx @opperai/cli <command>` (Node.js ≥ 20.12, no install required). For frequent use, install globally with `npm i -g @opperai/cli` so `opper <command>` is on PATH.
2. **Sign in once** — `npx @opperai/cli login` runs an OAuth device flow that links the CLI to your Opper account. Credentials are stored in `~/.opper/config.json`. Verify with `npx @opperai/cli whoami`.
3. **Launch any agent** — `opper launch <slug>` for terminal agents. `opper editors <slug>` for editor integration.

### For AI coding agents

If you are an AI coding agent helping a developer set up Opper, connect to the MCP server first: it can create the project and the API key once the developer approves it in the browser (https://opper.ai/mcp). Without MCP, one command does it:

```
npx @opperai/cli login && npx @opperai/cli config get default
```

`login` opens OAuth in the developer's browser. After approval, `config get default` prints the API key for the default credential slot to stdout. Capture it, set `OPPER_API_KEY`, and call 700+ models through the OpenAI SDK with `baseURL: https://api.opper.ai/v3/compat`. No further configuration.

## Supported agents

### Terminal agents — `opper launch <slug>`

| Agent | Slug | Integration |
|---|---|---|
| Claude Code | `claude` | Sets `ANTHROPIC_BASE_URL` / `ANTHROPIC_AUTH_TOKEN` |
| Codex | `codex` | `[model_providers.opper]` block in `~/.codex/config.toml` |
| OpenCode | `opencode` | Provider block in `~/.config/opencode/opencode.json` |
| OpenClaw | `openclaw` | Open-source personal AI agent |
| Hermes | `hermes` | Isolated `HERMES_HOME=~/.opper/hermes-home/` |
| Pi | `pi` | `opper` provider entry in `~/.pi/agent/models.json` |

**Switch the model behind any agent** with `--model`:

```bash
opper launch claude --model openai/gpt-5.5
opper launch claude --model anthropic/claude-opus-4-7
opper launch codex --model gemini/gemini-3.1-pro-preview
```

Forward arguments after `--`:

```bash
opper launch claude -- --print "Hello"
```

### Editor integrations — `opper editors`

| Editor | Command |
|---|---|
| OpenCode | `opper editors opencode [--global\|--local] [--overwrite]` (also exposed as `opper launch opencode`) |
| List available | `opper editors list` |

Cursor, Cline, and Continue.dev work today by manually pointing their OpenAI base URL at `https://api.opper.ai/v3/compat`. First-class CLI integration is on the roadmap.

## Why a gateway — residency, fallbacks, cost

The Agent CLI exists because the gateway behind it gives AI coding agents three things that are hard to get from running each agent directly:

- **EU data residency.** Every model in the catalog is tagged with where it's deployed. Configure your agent to route only to EU-hosted models — Claude on GCP Vertex EU, Sonnet on AWS Bedrock EU, open-weight models on Evroc — when inference has to stay in Europe.
- **Automatic fallbacks.** The same model (Claude Sonnet, say) is wired up across AWS, Azure, and GCP. If one upstream rate-limits or goes down mid-session, the gateway routes to the next without interrupting the agent.
- **Cheaper for routine work.** Not every prompt needs Opus. Run OpenCode or OpenClaw on a smaller or open-weight model for routine work — up to 98% cheaper for the same task — without leaving the CLI.

## Other useful commands

| Command | Purpose |
|---|---|
| `opper call --model <model> --stream <fn> "instructions" "input"` | Execute Opper functions with model selection and streaming |
| `opper agents list` | Show available agents |
| `opper skills` | Manage bundled Opper skills |
| `opper functions`, `opper models`, `opper traces`, `opper usage` | Manage platform resources |
| `opper image generate` | Create images from prompts |
| `opper config add <slot> <api-key> --base-url <url>` | Manage named credential slots |
| `opper logout` | Clear active session |

Use `opper` (no args) for an interactive menu, or `opper <command> --help` for command-specific flags.

### Credentials and slots

Credentials live in `~/.opper/config.json` with named slots. Resolution order: `OPPER_API_KEY` env var > `--key <slot>` flag > `default` slot.

```bash
opper config add staging <api-key> --base-url https://...
opper call --key staging myfunction "instructions" "input"
```

## Why use it

- **One key, every agent.** No per-provider keys for OpenAI, Anthropic, etc.
- **700+ models.** Switch the model behind any agent on the fly — `opper launch claude --model openai/gpt-5.5` puts Claude Code on GPT-5.5; `--model anthropic/claude-opus-4-7` switches it back to Opus.
- **Full observability.** Every call costed and logged through Opper's gateway, with full traces when tracing is on.
- **Zero re-config.** Install once, jump between Claude Code, Codex, OpenCode, OpenClaw, Hermes, Pi without touching your environment again.
- **EU-hosted.** The platform runs in the EU; configure the gateway to route only to EU-hosted models when inference has to stay in Europe.

## Pricing

The Opper Agent CLI is free. Sign up needs no credit card: you get an API key straight away and the free models work in the playground and the API. Add a card to use premium models, pay-as-you-go with no minimum. Inference is pay-as-you-go at provider rates with no markup, metered to your Opper account, with a 3% fee on credit top-ups. Claude Code via Opper costs the same as Anthropic's direct rate. Full pricing at https://opper.ai/pricing.

## FAQ

**How do I change the model or use a different LLM in Claude Code?**
Install the Opper CLI, run `opper login`, then launch Claude Code with any model via `opper launch claude --model <model-id>`. For example, `opper launch claude --model openai/gpt-5.5` runs Claude Code on GPT-5.5; `opper launch claude --model anthropic/claude-opus-4-7` runs it on Opus. Switch models mid-session by relaunching with a different `--model` flag — no config changes needed.

**How does this compare to claude-code-router or OpenRouter?**
claude-code-router is an open-source proxy you run and maintain locally. OpenRouter is a hosted inference gateway. The Opper Agent CLI is a hosted CLI that wraps both: install once, log in once, then `opper launch <agent>` routes Claude Code (and Codex, OpenCode, Hermes, Pi, OpenClaw) through Opper's gateway — with EU residency, automatic fallbacks, and pay-as-you-go billing. No local proxy to maintain.

**How is this different from running each agent directly?**
Most agents need their own provider keys, billing accounts, and rate-limit handling. With Opper you log in once and every agent shares the same key, the same 700+ model catalog, and the same observability — so switching from Claude Code to Codex to Hermes doesn't mean re-configuring your environment.

**Do I need separate API keys for OpenAI, Anthropic, etc.?**
No. Every supported agent runs through Opper's gateway, which routes to 700+ models with one Opper API key.

**Is Claude Code free? How much does it cost via Opper?**
The Opper Agent CLI is free. Sign up needs no credit card: you get an API key straight away and the free models work in the playground and the API. Add a card to use premium models, pay-as-you-go with no minimum. Inference is pay-as-you-go at provider rates with no markup, billed to your Opper account, with a 3% fee on credit top-ups. Claude Code via Opper costs the same as Anthropic's direct rate. Full pricing at https://opper.ai/pricing.

**Can I add my own agent?**
Any OpenAI- or Anthropic-compatible agent can point at Opper's `/v3/compat` endpoint directly. For first-class CLI support, reach out.

## Use cases — where the Agent CLI fits

| | Opper Agent CLI | Opper Account | Opper Platform |
|---|---|---|---|
| Audience | Developers running coding/personal agents on their machine | Apps where end-users pay for AI | Apps with flat pricing or AI as a bundled feature |
| Billing | Dev's Opper account | User funds one balance | App pays |
| Best for | Claude Code, Codex, OpenCode, personal AI tools | Per-use end-user billing | Bundled SaaS with AI features |

## Links

- [Opper CLI on GitHub](https://github.com/opper-ai/cli)
- [CLI documentation](https://docs.opper.ai/developer-tools/cli)
- [Opper LLM Gateway](https://opper.ai/llm-gateway)
- [Opper Account (sibling product)](https://opper.ai/ai-wallet.md)
- [Pricing](https://opper.ai/pricing.md)
- [Opper Platform sign-up](https://opper.ai/sign-up/free)
- [Claude Cowork via Opper (tutorial)](https://opper.ai/blog/claude-cowork-third-party-inference)
