Customer AI usage billing: meter + charge users for AI features (internal ops excluded)#200
Openccantynz opened this issue 24d ago
Ship Agent failed during the failed phase.
Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"Your credit balance is too low to access the Anthropic API. Please go to Plans & Billing to upgrade or purchase credits."},"request_id":"req_011CdtkQYLBbhZfXPNTXsKD1"}
Please review the issue and try again or implement manually.
Ship Agent failed during the failed phase.
Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"Your credit balance is too low to access the Anthropic API. Please go to Plans & Billing to upgrade or purchase credits."},"request_id":"req_011CdtkZnBNTHVaovJa11asj"}
Please review the issue and try again or implement manually.
c comment · e edit title · x close/reopen · ? shortcuts
Owner directive 2026-08-08: internal platform AI runs on the owner's Anthropic account (shipped in PR #5440 — admin-selectable, Opus 5 default); customers must pay for their AI usage.
What already exists (good news — most of the plumbing is done):
recordAiCost()→ai_cost_events, surfaced on/billing/usageand/api/v2/usage/*.gluecron_get_agent_budget) and Stripe bootstrap (scripts/stripe-bootstrap.ts) exist.What's missing — the enforcement + billing layer:
checkAiBudget(userId)guard at thegetAnthropic()/modelForTask()chokepoint returning a clear "AI quota exhausted — upgrade or add billing" error.ai_cost_eventsper user → Stripe usage records, with a configurable markup multiplier over Anthropic list price.Owner decisions needed before building:
Note on "Anthropic subscription": server-side platform AI calls bill to the Anthropic API account (usage-based) — a Claude Pro/Max subscription cannot back server-side automation. The internal/customer split shipped in #5440 controls which spend is whose, which is the part that matters.