MegaBrain CLI · open source

Open Source CLI Coding Agent

Any model, zero markup: frontier, open weight, or your own keys. One agent in your terminal, fully open source, wired to the MegaBrain Gateway.

$npm install -g @getmegabrain/cli

Free models included · No credit card required

Access 330+ AI models

Frontier, open weight, and free models through one gateway account — switch models mid-session from the picker.

Auto Model routing

Ship with mb-auto tiers that pick the right model per request — frontier for hard problems, cheap models for routine work.

Full BYOK support

Bring your own provider keys and route them through the gateway transparently — same model IDs, your billing.

Zero lock-in

Built on the MIT-licensed OpenCode agent. Your config, sessions, and workflows are plain files you own.

Workflow ready

Scriptable from CI and cron. Sign in once with device auth — no API keys to paste into pipelines.

Core features

A full coding agent, not an autocomplete

Everything the agent needs to plan, edit, verify, and ship — from a single terminal session.

Run parallel agents from one terminal

Fan work out to subagents for independent tasks — reviews, tests, refactors — while you keep the main thread on the problem.

Choose any model for the task

The full gateway catalog is registered in the model picker. Route routine edits to cheap models and planning to frontier ones.

Plan and Build modes

Ask for a plan before the agent touches code, then switch to build mode to execute it — native OpenCode modes, no setup.

LSP-aware editing

Language servers are on by default: the agent sees type errors and broken imports after every edit and fixes them before finishing.

Easy setup

From zero to agent in three steps

  1. Step 1

    Install the CLI

    One npm command. Requires Node.js 18 or later.

  2. Step 2

    Authenticate

    Run megabrain login and approve the sign-in in your browser — the gateway is wired up automatically.

  3. Step 3

    Start building

    Run megabrain in any project and hand the agent a task.

terminal
$ npm install -g @getmegabrain/cli
$ megabrain login
Signed in as you@example.com.
$ megabrain
Open source foundations

Built in the open, on OpenCode

Built on OpenCode

The agent core is the MIT-licensed OpenCode project — a proven terminal coding agent with an active community behind it.

Deep gateway integration

Device-auth sign-in, the full model catalog, Auto Model tiers, and LSP defaults are wired in for you — while your own OpenCode settings are preserved on every update.

Giving back

Improvements we make to the agent experience flow back upstream — open source is how the whole toolchain gets better.

FAQ

Frequently asked questions

How do I install the MegaBrain CLI?+

Run npm install -g @getmegabrain/cli (Node.js 18+), then megabrain login to connect your account. The CLI configures the agent and the gateway for you — no manual setup.

Which models can I use?+

Everything the MegaBrain Gateway serves — 330+ models across frontier labs and open-weight providers, plus the mb-auto routing tiers. The full catalog appears in the model picker after sign-in.

Do I need provider API keys?+

No. Signing in connects the CLI to the MegaBrain Gateway, which handles provider access. If you want to use your own keys, add them once at getmegabrain.com/byok — the CLI keeps working unchanged.

Is it really open source?+

Yes. The CLI wraps the MIT-licensed OpenCode agent and adds MegaBrain sign-in and gateway wiring. Your OpenCode config stays yours — the CLI merges its settings in instead of overwriting the file.

How is the CLI different from BrainClaw?+

Same gateway, same account, same models. The CLI runs in your terminal and CI, works over SSH, and is scriptable; BrainClaw is a hosted, always-on agent that works for you around the clock.

Does it cost anything?+

The CLI is free. Model usage is billed through your MegaBrain balance at provider rates with zero markup, and free models are available without a card — mb-auto/free routes across them automatically.

Ready to build faster?

Install the CLI, sign in once, and put an open source agent to work in your terminal.

$npm install -g @getmegabrain/cli