What gets metered
- Tokens in — prompt tokens sent to the LLM.
- Tokens out — completion tokens received.
- Cached tokens — prompt-cache reads (Anthropic) or assistant-cache writes (OpenAI).
- Reasoning / thinking tokens — extended-thinking tokens for Claude Opus / OpenAI o-series.
- Tool calls — count of tool invocations per session.
- Sandbox seconds — wall-clock time spent inside bubblewrap / Docker.
- Storage — sessions + memory + recordings on disk.
The rate card
The gateway-level rate card is a YAML map from (model, token-class) → USD-per-1M-tokens. Each LLM provider you use needs a row; reasoning and cache classes are separate from the base rates because they're priced differently upstream.
billing:
currency: USD
rate_card:
"claude-opus-4-7":
input: 15.00
output: 75.00
cache_read: 1.50
cache_write: 18.75
reasoning: 75.00
"claude-sonnet-4-6":
input: 3.00
output: 15.00
cache_read: 0.30
cache_write: 3.75
"gpt-4o":
input: 2.50
output: 10.00
"gpt-5":
input: 5.00
output: 25.00 Tenant overlays cannot override the rate card (it's admin-only). This prevents a tenant from quietly making their own bills cheaper.
Quotas — three knobs, hard-stop semantics
Each tenant has three independent quotas. Exceed any one and the
gateway returns 429 Too Many Requests with the
next-window reset time.
- Tokens per day — sum of input + output + reasoning, reset at UTC midnight.
- Cost per day (USD) — rate-card-driven cost, reset at UTC midnight.
- Requests per minute — sliding-window count of inbound calls.
Reports for your finance team
# Current month summary across all tenants
openclaw billing summary --period current-month
# Per-tenant detail, CSV
openclaw billing report acme --period current-month --csv > acme-2026-06.csv
# Daily rollup for a date range (good for invoicing)
openclaw billing rollup --tenant acme \
--from 2026-06-01 --to 2026-06-30 \
--format json > acme-2026-06.json The CSV columns are stable; pipe them straight into Stripe Billing, QuickBooks, or whichever invoicing system you use. Sample row:
date,tenant,model,tokens_in,tokens_out,tokens_cached,reasoning_tokens,tool_calls,sandbox_seconds,cost_usd
2026-06-03,acme,claude-opus-4-7,142500,38200,12300,5400,42,128.4,4.7821
2026-06-03,acme,claude-sonnet-4-6,891200,201400,84300,0,128,512.2,5.9241 Historical snapshots
Every cost calculation also snapshots the rate card that was in effect at the time. If you change the rate card, historical reports still reflect the prices that were charged when the requests happened. This is critical for audit — you can't be accused of backdating your bills.