Skip to main content
All billing routes live under /v1/billing/. They are organization-scoped and require an API key with billing:read or billing:write.

Webhook

Stripe events POST to /v1/internal/stripe-webhook. The handler verifies the signature against STRIPE_WEBHOOK_SECRET, deduplicates via the stripe_event table, and processes:
  • customer.subscription.created, customer.subscription.updated, customer.subscription.deleted
  • invoice.paid, invoice.payment_failed

Credit formula

credits = ceil(conversation_seconds × BILLING_CREDITS_PER_SECOND) (default coefficient 10). The agent runtime may suggest a cost_credits value on recordMetrics, but the API clamps and recomputes.