Skip to content
Docs menu

billing

Pay as you go. There are no plans and no monthly fee. Every workspace gets a free amount each month. A workspace with a payment method pays for what it uses past that, once a month, up to the limit it set. Payments go through Stripe. On a hub that takes no payments, every workspace has the free amount only.

6 operations · 12 schemas

POST /v1/billing/stripe-webhook

Stripe's webhook

receiveStripeWebhook · scope none

Where Stripe sends subscription and invoice events. The subscription is Stripe's monthly billing cycle. It has no fee of its own. The body is verified against the Stripe-Signature header with the endpoint's signing secret. An unsigned, mis-signed or stale event is 400, and nothing changes.

Each event is handled once, by its id. A delivery Stripe repeats answers 200 with duplicate: true. Subscription events record whether a workspace has a payment method. An invoice.created adds the closed period's use to that month's invoice. A workspace that removes its payment method is invoiced at once for the use not yet billed. Its hosted runs and endpoints are asked to stop. Paid and failed invoices are recorded. 503 means this hub has no signing secret configured.

Parameters

receiveStripeWebhook parameters
NameInTypeDescription
Stripe-Signaturerequiredheaderstring

length ≤ 1024

Request body

application/json · required · object

Responses

receiveStripeWebhook responses
StatusDescriptionBody
200

The event was handled, or was handled before.

StripeWebhookAck
400

The signature does not prove the event came from Stripe.

Problemapplication/problem+json
503

A service this endpoint needs is not configured in this deployment. The API boots with zero secrets. An endpoint that needs one says so instead of returning a stack trace.

Problemapplication/problem+json

GET /v1/billing/prices

The hub's prices

getBillingPrices · scope none

How each kind of use is priced, what every workspace may use free each month, and the monthly limit a workspace starts with. There are no plans. The pricing page reads this. configured is false on a hub that takes no payments. No workspace can add a payment method there.

Responses

getBillingPrices responses
StatusDescriptionBody
200

The free amount, the starting limit and the multipliers.

BillingPriceList
401

Missing or invalid credentials.

Problemapplication/problem+json

GET /v1/billing

A workspace's use this period, what it will pay and its cap

getBilling · scope key:read

Returns whether the workspace has a payment method, what it has used in the current billing period, its monthly cap and its invoices.

Use is priced at the hub's prices and grouped by AI model, GPU, sandbox and cloud CPU. A model call made with the workspace's own key is listed apart at $0. The free amount is used first. It covers AI models and the agent's sandbox. The next invoice charges the rest.

The period is the calendar month (UTC). The first period of a workspace starts on the day it added its payment method. The free amount is counted once a month, whatever happens to the payment method.

Parameters

getBilling parameters
NameInTypeDescription
ownerqueryHandle

Your own handle (the default) or the slug of an organization you belong to.

Responses

getBilling responses
StatusDescriptionBody
200

The workspace's billing.

Billing
401

Missing or invalid credentials.

Problemapplication/problem+json
403

Authenticated but not allowed (visibility, membership or scope).

Problemapplication/problem+json
404

Resource not found (or hidden from the caller).

Problemapplication/problem+json

PUT /v1/billing/cap

Set a workspace's monthly cap

setBillingCap · scope session

Sets the most a workspace may spend in a billing period, counting every kind of use at the hub's prices. Use stops at the cap. A call or a job that would pass it answers 402. Work already running keeps running.

Send null to remove the cap. Only a signed-in person sets a cap, so no key can raise its own. An organization's cap is set by its owners.

Until the workspace has paid an invoice, the cap cannot go above the one it started with, and it cannot be removed (422). getBilling gives that ceiling as cap.max_cap_usd.

Parameters

setBillingCap parameters
NameInTypeDescription
ownerqueryHandle

Your own handle (the default) or the slug of an organization you own.

Request body

application/json · required · BillingCapPut

setBillingCap request body
FieldTypeDescription
monthly_cap_usdrequirednumber | null

≥ 1 · ≤ 100000

The cap in US dollars, rounded down to the cent. Send null to remove it.

Responses

setBillingCap responses
StatusDescriptionBody
200

The cap, and where the period stands against it.

BillingCap
401

Missing or invalid credentials.

Problemapplication/problem+json
403

Authenticated but not allowed (visibility, membership or scope).

Problemapplication/problem+json
404

Resource not found (or hidden from the caller).

Problemapplication/problem+json
422

Request failed validation.

Problemapplication/problem+json

POST /v1/billing/checkout

Add a payment method

createBillingCheckout · scope session

Opens a Stripe Checkout page that saves a payment method and returns its address. Nothing is charged there. The workspace pays for what it uses once Stripe confirms the method, at the end of each month. Only a signed-in person may start it. The first invoice comes on the first of the next month. 409 means the workspace already has a payment method. 503 means this hub takes no payments.

Parameters

createBillingCheckout parameters
NameInTypeDescription
ownerqueryHandle

Your own handle (the default) or the slug of an organization you own.

Responses

createBillingCheckout responses
StatusDescriptionBody
200

Where to send the person.

BillingRedirect
401

Missing or invalid credentials.

Problemapplication/problem+json
403

Authenticated but not allowed (visibility, membership or scope).

Problemapplication/problem+json
404

Resource not found (or hidden from the caller).

Problemapplication/problem+json
409

State conflict (duplicate handle/slug, wrong repo kind, terminal job, ...).

Problemapplication/problem+json
502

Stripe could not be reached or refused the request. Nothing changed. Try again in a moment.

Problemapplication/problem+json
503

A service this endpoint needs is not configured in this deployment. The API boots with zero secrets. An endpoint that needs one says so instead of returning a stack trace.

Problemapplication/problem+json

POST /v1/billing/portal

Open the Stripe customer portal

createBillingPortal · scope session

Opens Stripe's customer portal for the workspace and returns its address. A person changes the card, downloads invoices or removes the payment method there. Only a signed-in person may open it. 409 means the workspace never added a payment method. 503 means this hub takes no payments.

Parameters

createBillingPortal parameters
NameInTypeDescription
ownerqueryHandle

Your own handle (the default) or the slug of an organization you own.

Responses

createBillingPortal responses
StatusDescriptionBody
200

Where to send the person.

BillingRedirect
401

Missing or invalid credentials.

Problemapplication/problem+json
403

Authenticated but not allowed (visibility, membership or scope).

Problemapplication/problem+json
404

Resource not found (or hidden from the caller).

Problemapplication/problem+json
409

State conflict (duplicate handle/slug, wrong repo kind, terminal job, ...).

Problemapplication/problem+json
502

Stripe could not be reached or refused the request. Nothing changed. Try again in a moment.

Problemapplication/problem+json
503

A service this endpoint needs is not configured in this deployment. The API boots with zero secrets. An endpoint that needs one says so instead of returning a stack trace.

Problemapplication/problem+json

Schemas (12)

The schemas these operations reach before any other tag’s do. A type that links elsewhere is rendered on that tag’s page.

StripeWebhookAck

object

StripeWebhookAck fields
FieldTypeDescription
receivedrequiredboolean
duplicateboolean
outcomestring | null

What the hub did with the event.

BillingPriceList

object

BillingPriceList fields
FieldTypeDescription
configuredrequiredboolean

True when this hub takes payments.

free_usdrequirednumber

What every workspace may use free each month, at the hub's prices. It covers AI models and the agent's sandbox. Cloud GPU is never free.

default_cap_usdrequirednumber

The monthly cap a workspace starts with when it adds a payment method.

pricesrequiredBillingPrices

Billing

object

Billing fields
FieldTypeDescription
ownerrequiredRepoOwner
configuredrequiredboolean

True when this hub takes payments.

can_managerequiredboolean

True when this credential may add a payment method, open the portal or set the cap. That takes a signed-in person who is the workspace, or one of its owners.

paymentrequiredBillingPayment
period_startrequiredstring (date-time)
period_endrequiredstring (date-time)
usagerequiredBillingUsage
caprequiredBillingCap
session_cap_usdnumber | null

The default cap on one agent session's spend.

invoicesrequiredarray of BillingInvoice

The workspace's invoices, newest first.

pricesrequiredBillingPrices

BillingCapPut

object

BillingCapPut fields
FieldTypeDescription
monthly_cap_usdrequirednumber | null

≥ 1 · ≤ 100000

The cap in US dollars, rounded down to the cent. Send null to remove it.

BillingCap

object

BillingCap fields
FieldTypeDescription
monthly_cap_usdrequirednumber | null

The most the period may cost. Null means no cap.

committed_usdrequirednumber

Recorded use plus what work still running may cost.

remaining_usdnumber | null

What is left under the cap. Null without a cap.

max_cap_usdnumber | null

The highest cap the workspace may set now. Null means any cap, or none. A workspace that has not paid an invoice yet is held to the cap it started with.

stoppingrequiredboolean

True when the cap is reached, so new calls and jobs answer 402.

BillingRedirect

object

BillingRedirect fields
FieldTypeDescription
urlrequiredstring

A Stripe page to send the person to.

BillingPrices

object

How the hub prices each kind of use.

BillingPrices fields
FieldTypeDescription
model_markup_pctrequirednumber

Added to the vendor's list price on a call the hub pays for, when the hub takes payments. Zero when it does not.

gpu_multiplierrequirednumber

The GPU provider's price is multiplied by this.

cpu_multiplierrequirednumber

Cloud CPU and the agent's sandbox are the provider's price times this.

sandbox_rate_usd_per_hourrequirednumber

What one hour of the agent's sandbox costs, as billed.

BillingPayment

object

Whether the workspace pays for its use, and when it is next invoiced.

BillingPayment fields
FieldTypeDescription
method_on_filerequiredboolean

True when the workspace has a payment method. It then pays for what it uses past the free amount. Without one, use stops at the free amount and cloud GPU is not available.

statusrequiredstring

one of none · active · trialing · past_due · incomplete · canceled · unpaid

The state of the monthly billing as Stripe reports it. none without a payment method. A past_due workspace that has paid an invoice before keeps working while Stripe retries the card. One that never paid stops at once.

next_invoice_atstring (date-time) | null (date-time)

When the current period ends and the next invoice is made.

ends_at_period_endboolean

True when the payment method was removed. Billing stops at next_invoice_at, with a last invoice for the period's use.

BillingUsage

object

BillingUsage fields
FieldTypeDescription
total_usdrequirednumber

Use recorded this period at the hub's prices.

reserved_usdrequirednumber

What calls and jobs still running may cost at most. It counts against the cap until each one settles.

free_usdrequirednumber

What the workspace may use free this period. It covers AI models and the agent's sandbox. It is counted once a calendar month. A period that began in the middle of a month has what was left.

free_used_usdrequirednumber

How much of the free amount is used.

billable_usdrequirednumber

Use past the free amount. The next invoice charges it. Zero without a payment method, where use stops at the free amount.

linesrequiredarray of BillingUsageLine

Models, GPU, sandbox and cloud CPU, in that order. A line with no use is left out.

own_keysrequiredarray of BillingUsageItem

AI model calls made with the workspace's own keys. They cost $0 here.

BillingInvoice

object

BillingInvoice fields
FieldTypeDescription
idrequiredstring

Stripe's invoice id.

numberstring | null
statusrequiredstring

one of draft · open · paid · uncollectible · void

amount_due_usdrequirednumber
amount_paid_usdrequirednumber
usage_usdnumber | null

The part of the invoice that is the period's use past the free amount.

period_startstring (date-time) | null (date-time)
period_endstring (date-time) | null (date-time)
urlstring | null

Stripe's page for the invoice.

created_atrequiredstring (date-time)

BillingUsageLine

object

BillingUsageLine fields
FieldTypeDescription
categoryrequiredstring

one of model · gpu · sandbox · cpu

labelrequiredstring
total_usdrequirednumber
itemsrequiredarray of BillingUsageItem

BillingUsageItem

object

One AI model, one GPU, the sandbox or cloud CPU, over the period.

BillingUsageItem fields
FieldTypeDescription
keyrequiredstring

The catalogue id, the GPU tier, sandbox or cpu.

labelrequiredstring
vendorLlmVendorId | null
callsinteger | null

AI model calls, for a model.

input_tokensinteger | null

Input tokens read, cached ones included.

output_tokensinteger | null
hoursnumber | null

Hours of use, for a GPU, the sandbox or cloud CPU.

cost_usdrequirednumber

At the hub's prices. Zero for calls made with your own key.

list_cost_usdnumber | null

What the vendor's list price comes to, for calls made with your own key.