Skip to content

Billing

ResourceUnitNotes
Runtime instanceseconds runningCharged at the tenant’s plan rate.
LLM tokens (BYOK)passed-throughcloudscode does not mark up tokens; you pay your provider directly.
Outbound webhooksper deliveryCheap; included in most plans.
StorageGB-monthConversation history, replays, audit.
Egress bandwidthGBPlan-dependent.

Plans are stored in the plans table and referenced by name on each tenant. A plan defines:

  • monthly base credit allotment,
  • per-resource rates above that allotment,
  • concurrency limits (max concurrent instances, max requests/sec),
  • feature flags (e.g. team SSO, audit-log export).

Tenants spend credits, not currency. Credits are minted when a tenant tops up (whatever your processor) and consumed as resources run. The credit ledger is append-only and reconcilable.

Terminal window
curl -sS http://localhost:8787/credits \
-H "x-tenant-id: <tenant_id>"
# => { "balance": 12500, "currency": "credits", "as_of": "2026-04-29T12:00:00Z" }

To wire a real processor (Stripe, Paddle, a manual invoice flow, …), implement the BillingProcessor interface in apps/api/src/lib/billing/. The interface is small: topUp, refund, webhook. See the source for the canonical contract.