Claude API

Claude API, pay as you go

Anthropic’s Claude models through the MegaBrain API: one key instead of an Anthropic Console account, paid per token from a prepaid US-dollar balance. Sign-up is open and you top up by card. The same key also opens GPT, Gemini, DeepSeek and image and video generation.

Claude models and prices

Prices in US dollars per 1M tokens, from the MegaBrain catalogue; they update automatically.

ModelInputOutputContext
Claude Fable 5.2
anthropic/claude-fable-5.2
$9.6$481M
Claude Opus 5.5
anthropic/claude-opus-5.5
$1.92$9.61M
Claude Sonnet 5.5
anthropic/claude-sonnet-5.5
$0.96$4.81M
Claude Haiku 5.5
anthropic/claude-haiku-5.5
$0.07$0.361M
Claude Fable 5.1
anthropic/claude-fable-5.1
$4.8$241M
Claude Opus 5
anthropic/claude-opus-5
$2.4$121M
Claude Sonnet 5
anthropic/claude-sonnet-5
$1.02$5.131M
Claude Fable 5
anthropic/claude-fable-5
$4.8$241M
Claude Opus 4.8
anthropic/claude-opus-4.8
$2.4$121M
Claude Opus 4.7
anthropic/claude-opus-4.7
$1.71$8.581M

All Anthropic models in the catalogue — 15

Claude Code on a MegaBrain key

Claude Code runs on a MegaBrain key without a Claude subscription. MegaBrain University has a step-by-step guide: the base URL, the environment variables, which model to pick and a team setup.

Guide: Claude Code on MegaBrain

Which Claude model to pick

Fable is Anthropic’s flagship line, Opus is for hard tasks and code, Sonnet balances price and quality, and Haiku handles fast, inexpensive tasks. The price of each model per 1M tokens is in the table.

First request

The API is OpenAI-compatible: the official SDK, LangChain and any client with a base URL field work. Create the key on the API key page after you sign up.

from openai import OpenAI

client = OpenAI(
    base_url="https://getmegabrain.com/api/gateway/v1",
    api_key="YOUR_MEGABRAIN_KEY",
)

response = client.chat.completions.create(
    model="anthropic/claude-sonnet-5.5",
    messages=[{"role": "user", "content": "Hello! What can you do?"}],
)
print(response.choices[0].message.content)

Questions and answers

How do I get a Claude API key without an Anthropic account?

Sign up on MegaBrain, top up the balance by card and create a key on the API key page. Send requests to https://getmegabrain.com/api/gateway/v1 with an id from the table, such as anthropic/claude-sonnet-5.5. The same key works for every model in the catalogue.

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.

How do I connect Claude Code?

Follow the Claude Code guide in MegaBrain University: it gives the address for ANTHROPIC_BASE_URL, puts the key in ANTHROPIC_AUTH_TOKEN and shows which model to pick.

Which request format does the API accept?

The OpenAI format (chat/completions) at https://getmegabrain.com/api/gateway/v1, so the OpenAI SDK, LangChain and any compatible client work. The Anthropic SDK and Claude Code connect to https://getmegabrain.com/api/anthropic, which speaks the Anthropic Messages API.

Can I try it for free?

Yes. The model mb-auto/free (Auto Free) is free and works without an API key or sign-up: each request goes to a free model available at that moment, with a limit per IP address. The paid models in the table need an account and a balance.

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