Skip to main content

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

Returns the available plans, the authenticated user’s current plan, subscription status, BYOK status, and daily usage.

Response

Response fields

Errors

Billing actions

Performs a billing action. The 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

Redirect the user to the returned 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:

Subscription deploy

Records a subscription-to-plan mapping so the next agent deployment uses the correct resource tier. This endpoint is called by the Stripe webhook after a checkout completes.
This is a backend-only endpoint that requires bearer token (API key) authentication.

Request body

Response

Plan resource allocations

Errors