Guides

Set a ceiling on agent spend.

Prepaid credits, per-key caps and one key per agent.

Get a key — no account
Base URLhttps://api.minirouter.sh/v1

The balance itself

Credits are prepaid. When they run out, requests stop. No invoice arrives later.

Spend over time under a postpaid bill and a prepaid balanceBoth lines track together while the agent behaves. When a loop starts running away, the postpaid line keeps climbing without limit; the prepaid line flattens at the balance and stops, because there is nothing left to spend.your balancepostpaidprepaid — stops here
There are no withdrawals.
Credits buy inference and never convert back to coin. A small balance is the containment, not a cash position.

Per-key caps

Four limits, enforced at the edge for each key. Open reservations count the moment a request starts, so concurrent bursts cannot slip past a cap.

rpmLimit
requests per minute
tpmLimit
estimated input and output tokens per minute
dailyLimitNano
daily spend cap in nano-USD
monthlyLimitNano
monthly spend cap in nano-USD

Accountless keys start lower, and every limit can be raised per key. A refused request returns 429 with Retry-After, naming the limit and where to raise it. See /docs/rate-limits.

What to set the cap to

Cost one turn, multiply by a day of turns, then set the cap above that and below what you would mind losing.

Input tokens per turn
4KSystem prompt, tools and history, re-sent each turn.
Output tokens per turn
250A short reply or a tool call.
Turns in a runaway
480One a minute for 8 hours, overnight.
Cost of an 8-hour runaway, by model, at current catalog rates
ItemUSD

DeepSeek V4 Flash 0731$0.29 · 53% of chart maximum

One turn costs $0.0006 on DeepSeek V4 Flash 0731 and $0.0012 on GPT 5.6 Luna. Choose the model first, then the cap.

Round up, not down.
A cap that trips during normal work trains you to raise it without thinking. Set it at several times your expected day, so hitting it means something.

One key per agent

A habit, not a mechanism, and the one that does the most work. When one agent hits its cap, the others keep running and you know which to inspect.

What hitting a ceiling looks like

Each error stands alone, because it is read inside someone else’s chat app.

the balance header on every response
curl https://api.minirouter.sh/v1/chat/completions \
  -H "Authorization: Bearer $MINIROUTER_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"meta/llama-3.3-70b","messages":[{"role":"user","content":"ping"}]}' \
  -D - -o /dev/null

# every response carries the balance, so an agent can warn you
# before it runs dry rather than after:
#   x-minirouter-balance-usd: 4.81
#   x-minirouter-cost-usd: 0.0004
#   x-minirouter-provider: together
#   x-minirouter-ttft-ms: 240
Before any tokens arrive.
A 402 naming the shortfall, when the balance is below the estimated cost.
Mid-stream.
A terminal error with the exact charge for tokens delivered, then a clean close. Never a silent truncation.
At a rate cap.
A 429 with Retry-After, naming the limit and where to raise it.
Every error carries a URL.
The only navigation inside a chat pane. /docs/errors

Keep going