Paradaux

PAR-193

0

[Epic] Monetisation — metering, seats, billing, PAYG AI token accounting

DoneNormalUnassignedTesksFeature

Greenfield — no billing/metering/usage code anywhere; the tenant substrate exists but nothing meters it.

Scope:

  • AI token accounting (do early): the LLM client throws away OpenAI's usage block (tesks/.../llm/OpenAiLlmClient.java). Capture token usage and attribute to TenantContext now, even before billing exists, so historical usage isn't lost.
  • Per-seat model: plan + seat limits on tenant; enforce in WorkspaceAdminService.addMember.
  • Usage metering / limits: a usage_event/usage_counter table keyed by tenant; meter at TenantBearerFilter/WorkspaceContext (every request already resolves a tenant); enforce limits before the request proceeds.
  • PAYG AI billing for tokens; per-team + per-workspace billing reporting tied into the analytics epic.
  • Stripe (cloud) integration; self-hosted bypasses billing.

Billing is workspace-level; reporting breaks down per team/workspace.

Resources

Comments

tesks · Jun 16, 2026, 9:42 AM

Metering foundation shipped to develop (tesks a4eba8b) — the internal, non-payment half:

  • Migration V24: usage_event (per-workspace granular usage) + tenant.seat_limit.
  • UsageService records events for the bound workspace and implements LlmUsageSink; OpenAiLlmClient now captures each completion's token usage (previously discarded) and reports it per tenant. Seat limits enforced on member add. 3 tests; suite 124 green.

Remaining (split out, design-first / external):

  • PAR-202 Stripe billing — plans, checkout, webhooks, PAYG AI (needs your decisions on tiers + Stripe creds; outward-facing payment surface).
  • PAR-203 Usage & billing reporting UI (surface tokens/seats + per-team/workspace rollups).

Keeping this epic In Progress until the billing children land.

tesks · Jun 16, 2026, 10:00 AM

Monetisation now has both halves built and shipped to develop, intentionally not activated:

  • Metering foundation (token capture + seats) — a4eba8b.
  • Billing scaffolding (plans, entitlements, Stripe provider + webhook gated off) — 8880281, per the "settle + implement so it's drop-in in ~2 months" brief (PAR-202, Pending Release).

Remaining: PAR-203 usage/billing reporting UI (and the live activation, which is config-only when wanted). The epic can ride to release as the foundation; PAR-203 is the open follow-up.

Activity

  • paradaux changed status to Status → Done
  • tesks changed status to Status → In Progress
  • ParadauxIO linked a commit — Commit a4eba8b — Add usage metering foundation: AI token capture + seats (PAR-193)
  • tesks commented
  • tesks commented
  • tesks created the issue