Billing API
Retrieve billing information and perform subscription actions such as creating a checkout session, enabling bring-your-own-key (BYOK) mode, checking usage, and purchasing credit packs.All billing endpoints require session authentication.
Get billing info
Response
Response fields
The
currentPlan value is set by the Stripe webhook when a checkout completes. Plans created through the primary checkout flow (/api/stripe/checkout) use solo, collective, label, or network. The billing dashboard displays these with their plan names: solo appears as “Solo”, collective as “Collective”, and label as “Label”.Errors
Billing actions
action field in the request body determines which operation is executed.
Create checkout session
Creates a Stripe checkout session for subscribing to a plan.Request body
Response
url to complete payment.
Errors
Enable BYOK
Enables bring-your-own-key mode with an external AI provider. When BYOK is active, AI requests are billed directly by the provider rather than consuming platform credits.Request body
Response
Errors
Disable BYOK
Disables BYOK mode and reverts to platform credits.Request body
Response
Get usage
Returns the current day’s unit consumption.Request body
Response
Buy credits
Purchases a credit pack.Request body
Response
Errors
Common errors
These apply to all billing POST actions:Stripe checkout
solo, collective, label, and network plan names with GBP pricing. Admin users (configured via ADMIN_EMAILS) bypass Stripe and are redirected directly to the onboarding page.
The Stripe checkout plans (
solo, collective, label, network) use different identifiers and GBP pricing from the billing API plans (starter, pro, scale with USD pricing). The checkout plans are the primary subscription path for agent provisioning. The billing dashboard displays checkout plan IDs with their plan names: solo as “Solo”, collective as “Collective”, and label as “Label”.Query parameters
Checkout plan pricing
Response
On success, redirects (303) to the Stripe checkout URL. On error, redirects to the pricing page with an error query parameter.Subscription deploy
This is a backend-only endpoint that requires bearer token (API key) authentication.