# BitPlan Gateway (gateway.bitplan.dev) > An OpenAI-compatible inference API and MCP server for every model on Vercel AI Gateway, OpenRouter and OpenCode, paid in BSV over HTTP 402. No account and no API key: your Bitcoin key is the identity and your wallet pays per call. ## When to use this Reach for BitPlan Gateway when: - You are an agent that needs a model call (chat, tools, images) and can pay from a BSV wallet, or a person can fund you by paymail or card. - You want any frontier model (Anthropic, OpenAI, Google, xAI, DeepSeek, open models) through one OpenAI-format endpoint or one MCP server, without creating accounts or holding provider keys. - You want to pick a model by price at call time: GET /v1/models returns every model in sats and USD per million tokens with the markup included. - You already pay Vercel AI Gateway or OpenCode and want to run on your own key for a 5% fee instead of 20%. Do not use it for: fiat-only billing, or models that need the Responses or Anthropic Messages wire format on OpenCode (only chat-completions models are exposed there). ## How to call it - MCP server (Streamable HTTP, no auth): https://mcp.bitplan.dev — tools list_models, chat, generate_image, credits, deposit - HTTP API: POST https://gateway.bitplan.dev/v1/chat/completions (OpenAI format; `"model": "auto"` (listed as `bitplan/auto`, the Jev Model Router) scores the request with typesafe-ai/jev on intent, difficulty, creativity, exactness and urgency, has Jev pick from a shortlist described by Artificial Analysis benchmarks and price, and runs it on the best-ranked candidate; `x-gateway-routed-model` names it; an image request gets a pointer to the images endpoint instead, header `x-gateway-suggest: images`, nothing charged), POST /v1/images/generations (`"model": "auto"` picks the best image model for its price by Artificial Analysis Image Arena Elo), POST /v1/images/generations, POST /v1/evaluate (typed classify/score/boolean questions over a state, answered by typesafe-ai/jev in under a second for a fraction of a cent: `{"state": "...", "questions": {"intent": {"type": "choice", "instructions": "...", "criteria": {"coding": "...", "writing": "..."}}}}`), GET /v1/models, GET /v1/account, POST /v1/deposit - Anthropic Messages API: POST https://gateway.bitplan.dev/v1/messages (same metering; Claude Code works with ANTHROPIC_BASE_URL=https://gateway.bitplan.dev ANTHROPIC_AUTH_TOKEN= ANTHROPIC_MODEL=anthropic/claude-fable-5.1) and POST /v1/messages/count_tokens (free estimate) - Bring your own key: PUT /v1/account/byok with a lab key (provider anthropic, openai, google, spacexai, deepseek, mistral, moonshotai, alibaba, zai, minimax, meta) or a Vercel AI Gateway key; calls that run on your key pay the gateway nothing for the model (the lab bills you); the router, web search and evaluate are billed at your tier. - Web search: add `"tools":[{"type":"vercel:perplexity_search"}]` (or exa_search, parallel_search, tako_search) to a chat completion and the gateway searches for the model inside the call; the search fee (about half a cent) is billed with it. The MCP chat tool takes `web_search: true`. - max_tokens: keep the default 8192 or higher. The hold covers it but only used tokens are billed. Models with `reasoning: true` in /v1/models think first; caps under `min_max_tokens` (1024) are raised to it (header `x-gateway-max-tokens`), and an empty answer with finish_reason length is billed for the prompt only and carries an `x-gateway-hint` header saying to raise the cap. - OpenAI Responses API: POST https://gateway.bitplan.dev/v1/responses (same metering; stateless, history in `input`; function, custom and namespace tools; no hosted tools). Codex CLI: `[model_providers.bitplan]` with `base_url = "https://gateway.bitplan.dev/v1"`, `env_key = "BITPLAN_TOKEN"`, and a profile with `model_provider = "bitplan"`, `model = "anthropic/claude-fable-5.1"`; `export BITPLAN_TOKEN=$(bitplan gateway token)`, then `codex --profile bitplan` - OpenAPI 3.1: https://gateway.bitplan.dev/openapi.json - Developer docs: https://gateway.bitplan.dev/docs (also served as Markdown with `Accept: text/markdown`, as is the home page) - Discovery: https://gateway.bitplan.dev/.well-known/x402-info - Skill for coding agents: `npx skills add opldotdev/bitplan.dev --skill gateway -g` - OpenCode plugin: `opencode-plugin-bitplan` (provider `bitplan`; pays 402s from a BRC-100 wallet) - CLI: `bitplan gateway token | credits | deposit | models` (npm: bitplan) ## Payment A request without credits returns HTTP 402 in x402 protocol version 2 (github.com/coinbase/x402): the `PAYMENT-REQUIRED` header (and the body) carry a PaymentRequired with `accepts[0]` = `{scheme:"exact", network:"bip122:000000000019d6689c085ae165831e93", amount:"", asset:"BSV", payTo:"
", extra:{challengeId, lockingScript}}`. Pay `amount` sats to `payTo` from any BSV wallet using a P2PKH input, then repeat the identical request with `PAYMENT-SIGNATURE: base64({"x402Version":2,"accepted":,"payload":{"transaction":""}})`; the response carries `PAYMENT-RESPONSE` with the txid. The legacy `challenge` body and `X402-Proof` header are still accepted. The paying key becomes the account; each call holds an upper bound and settles at what the provider billed, and the unused reserve stays as credits. A 402 asks for exactly what the call needs (minimum 2,000 sats); `x-gateway-deposit: minimum` asks for a 0.25 BSV top-up instead. Every account is also a paymail: anyone can add credits by sending BSV to the `paymail` that GET /v1/account reports (three words at @bitplan.dev, or a claimed handle via PUT /v1/account/paymail). An authenticated 402 carries it as `fund.paymail`; retry once the credits show up. People can also buy credits by card on the home page. bsvalias discovery: https://gateway.bitplan.dev/.well-known/bsvalias ## Prices Provider cost plus a markup that falls with 30-day usage: 20% to start, 10% after $100, 7% after $1,000; 5% on your own key. Peak windows, long-context tiers and regional rates are exposed per model on GET /v1/models so an agent can plan spend. ## Identity Optional bearer in the bitcoin-auth format `pubkey|scheme|timestamp|requestPath|signature`; session tokens use requestPath `https://gateway.bitplan.dev/v1` and last 24 hours. Schemes brc77 (raw key) and brc100 (wallet createSignature, protocol [1, "bitcoin auth"], keyID = timestamp, counterparty anyone). ## Quick start for an agent 1. Add the MCP server https://mcp.bitplan.dev, or call POST https://gateway.bitplan.dev/v1/chat/completions with an OpenAI-format body. 2. Call list_models (or GET /v1/models) and pick a starred model. 3. Call chat. If the result is payment_required, pay the challenge from your BSV wallet and call chat again with the proof. A person can also fund your account by sending BSV to your paymail. 4. With a bearer token, payment is only requested when credits run out.