# Billing for agents

How DREAM is spent when an AI agent uses BunCho through the CLI, the MCP server
or the HTTP API. These rules are the same for all three.

## One wallet

- There is one DREAM balance per BunCho account. The web app, the HTTP API,
  the MCP server and the CLI all spend from it. There is no separate balance
  for agents or for the CLI.
- Every call that makes something spends DREAM, every time. There is no flat
  or unlimited plan for agent use.
- Prices are in DREAM. 1 DREAM is about JPY 0.71 including tax (the JPY 300 pack
  gives 420 DREAM; larger packs cost less per DREAM). The public price table:
  https://bun-cho.work/developers/pricing.json

## Price first, then a hold, then the actual amount

1. `buncho cost ...` / `POST /estimate` (free) returns `dream` (typical) and
   `max_dream` (the most it can cost).
2. When a paid call starts, BunCho holds up to the quoted amount from the
   balance. If the balance is too small, nothing starts (`402`).
3. When it finishes, BunCho takes the actual amount, never more than the hold,
   and returns the rest. Failed or timed-out jobs are refunded in full.
4. Every paid request carries an `Idempotency-Key` (the CLI adds one). A retry
   with the same key returns the first result and is not charged again.

## What counts toward agent use

| DREAM in the account | Usable from the API, MCP and CLI |
| --- | --- |
| DREAM packs you bought | Yes, for every model |
| Monthly DREAM of a BunCho plan | Yes (same wallet) |
| Auto top-up purchases | Yes (they are pack purchases) |
| Free DREAM (first MCP connection: 300, first API key: 50 for 30 days, campaigns, referrals) | Yes, for BunCho's own models. External premium models need paid DREAM (`paid_dream_required`) |
| Free trials that are part of a web page (for example a free sample comic or a game's trial turns) | No. They exist only on that page |

## Limits a person sets

An agent cannot change any of these.

- **Per connection (MCP and `buncho login`)**: a monthly DREAM limit chosen
  on the consent screen when connecting. New connections default to 500 DREAM
  a month; the person can pick another value or no limit. Over the limit, the
  call stops with `connection_budget_exceeded` and the agent must ask the
  person.
- **Per API key**: requests per minute, concurrency, DREAM per day, and,
  optionally, a total DREAM budget, an expiry date and the allowed endpoints
  (set only on https://bun-cho.work/studio/developers).
- **`--max-dream` (CLI)**: the CLI stops before starting if the estimate is
  higher than the amount the person agreed to.

## Paying

- A person always pays. The first purchase is made on the web (Stripe
  Checkout). After that, either auto top-up (if the person turned it on, with
  monthly count and amount limits) or a payment link:
  `buncho buy --pack <id>` / `POST /billing/checkout` / MCP `buy_dream`.
- Only the existing packs can be bought (`GET /pricing` → `packs`); there are
  no custom amounts.
- On `402`, the error names the smallest pack that covers the shortfall
  (`recommended_pack`), a link with that pack selected (`purchase_url`) and
  whether auto top-up is on (`auto_charge`).
- Receipts: `buncho purchases` / `GET /purchases` (`invoice_url`).
