Claude Code at half the official price
Claude Code, Anthropic’s coding agent for the terminal, VS Code and JetBrains, on a MegaBrain key: Claude Opus 5.5 and Sonnet 5.5 for less than half the official price per token, no Claude subscription, paid from a prepaid US-dollar balance. One command sets it up; the prices per 1M tokens are in the table.
Claude models for Claude Code and prices
Prices in US dollars per 1M tokens, from the MegaBrain catalogue; they update automatically.
| Model | Input | Output | Context |
|---|---|---|---|
| Claude Fable 5.2 anthropic/claude-fable-5.2 | $9.6 | $48 | 1M |
| Claude Opus 5.5 anthropic/claude-opus-5.5 | $1.92 | $9.6 | 1M |
| Claude Sonnet 5.5 anthropic/claude-sonnet-5.5 | $0.96 | $4.8 | 1M |
| Claude Haiku 5.5 anthropic/claude-haiku-5.5 | $0.07 | $0.36 | 1M |
| Claude Fable 5.1 anthropic/claude-fable-5.1 | $4.8 | $24 | 1M |
| Claude Opus 5 anthropic/claude-opus-5 | $2.4 | $12 | 1M |
| Claude Sonnet 5 anthropic/claude-sonnet-5 | $1.02 | $5.13 | 1M |
| Claude Fable 5 anthropic/claude-fable-5 | $4.8 | $24 | 1M |
| Claude Opus 4.8 anthropic/claude-opus-4.8 | $2.4 | $12 | 1M |
| Claude Opus 4.7 anthropic/claude-opus-4.7 | $1.71 | $8.58 | 1M |
Instead of a Claude subscription
Claude Code usually runs on a Claude subscription or an Anthropic Console key. With MegaBrain it connects to the MegaBrain gateway with a key, and tokens are paid from your balance: Opus 5.5 costs less here than Sonnet 5.5 does at the official price, so there is no reason to save on the model. No weekly limit, no subscription, credits never expire.
Set up in one command
The setup script asks for your key, checks it, and writes the MegaBrain address, key and models into ~/.claude/settings.json (and ~/.codex/config.toml if you use Codex), keeping a backup of each file. Or add the three lines by hand: VS Code, GitHub Actions and scripts are covered in the step-by-step guide.
Guide: Claude Code on MegaBrainFor a team
Each developer gets their own key: usage per key shows in the dashboard, and revoking one key cuts off one person. The balance is shared and there is no per-seat fee.
Claude models only
Anthropic supports Claude Code on Claude models. For GPT, Gemini, DeepSeek or Kimi on the same key, use Codex, OpenCode or Kilo Code: their guides are in MegaBrain University too.
MegaBrain University: AI agent guidesFirst request
Create the key on the API key page after you sign up and add the env block to ~/.claude/settings.json; it applies to every project. The address has no /v1: Claude Code appends /v1/messages itself. Or let the setup script at the end do it all: it needs Node 18 or newer, which Claude Code already has.
{
"env": {
"ANTHROPIC_BASE_URL": "https://getmegabrain.com/api/anthropic",
"ANTHROPIC_AUTH_TOKEN": "your-megabrain-key",
"ANTHROPIC_MODEL": "anthropic/claude-opus-5.5",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "anthropic/claude-opus-5.5",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "anthropic/claude-sonnet-5.5",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "anthropic/claude-haiku-5.5"
}
}Check the address and the key with one request before you start claude:
curl -sS -X POST "https://getmegabrain.com/api/anthropic/v1/messages" \
-H "Authorization: Bearer $MEGABRAIN_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d '{"model": "anthropic/claude-haiku-5.5", "max_tokens": 20, "messages": [{"role": "user", "content": "Reply: OK"}]}'Or do all of it in one command (macOS and Linux; on Windows PowerShell: irm https://getmegabrain.com/setup.mjs -OutFile mb-setup.mjs; node mb-setup.mjs):
curl -fsSL https://getmegabrain.com/setup.mjs -o mb-setup.mjs && node mb-setup.mjsQuestions and answers
Do I need a Claude subscription to use Claude Code?
No. Sign up on MegaBrain, create a key and put it in Claude Code’s settings as shown below. Tokens are paid from a prepaid US-dollar balance at the prices in the table.
Which models should I pick for Claude Code?
anthropic/claude-sonnet-5.5 for everyday coding, anthropic/claude-opus-5.5 or anthropic/claude-fable-5.2 for hard refactoring and architecture, and anthropic/claude-haiku-5.5 for background tasks. The price of each model is in the table.
How do I install Claude Code?
On macOS, Linux and WSL, with the official installer: curl -fsSL https://claude.ai/install.sh | bash. With npm: npm install -g @anthropic-ai/claude-code. Then add the settings from the example below.
Does it work in VS Code and CI?
Yes. The VS Code extension takes the same variables in claudeCode.environmentVariables, GitHub Actions takes them in the job’s env, and claude -p "task" runs one task from a script or cron without the interface.
How are requests paid for?
From a prepaid balance in US dollars, for the tokens actually used: input and output separately, at the price per 1M tokens in the table. No subscription is needed: top up by card and pay as you go.
Get your API key
Sign-up is open. Create an account, top up the balance by card and create a key: it works for every text, image, video and audio model in the catalogue. Credits never expire.
Questions? Write to team@getmegabrain.com