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.
POST / v1/ billing/ stripe-webhook
Stripe's webhook
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
| Name | In | Type | Description |
|---|---|---|---|
Stripe-Signature | header | string |
Request body
Responses
| Status | Description | Body |
|---|---|---|
200 | The event was handled, or was handled before. | StripeWebhookAck |
400 | The signature does not prove the event came from Stripe. | Problem |
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. | Problem |
GET / v1/ billing/ prices
The hub's prices
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
| Status | Description | Body |
|---|---|---|
200 | The free amount, the starting limit and the multipliers. | BillingPriceList |
401 | Missing or invalid credentials. | Problem |
GET / v1/ billing
A workspace's use this period, what it will pay and its cap
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
| Name | In | Type | Description |
|---|---|---|---|
owner | query | Handle | Your own handle (the default) or the slug of an organization you belong to. |
Responses
PUT / v1/ billing/ cap
Set a workspace's monthly cap
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
| Name | In | Type | Description |
|---|---|---|---|
owner | query | Handle | Your own handle (the default) or the slug of an organization you own. |
Request body
| Field | Type | Description |
|---|---|---|
monthly_cap_usd | number | null | The cap in US dollars, rounded down to the cent. Send |
Responses
| Status | Description | Body |
|---|---|---|
200 | The cap, and where the period stands against it. | BillingCap |
401 | Missing or invalid credentials. | Problem |
403 | Authenticated but not allowed (visibility, membership or scope). | Problem |
404 | Resource not found (or hidden from the caller). | Problem |
422 | Request failed validation. | Problem |
POST / v1/ billing/ checkout
Add a payment method
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
| Name | In | Type | Description |
|---|---|---|---|
owner | query | Handle | Your own handle (the default) or the slug of an organization you own. |
Responses
| Status | Description | Body |
|---|---|---|
200 | Where to send the person. | BillingRedirect |
401 | Missing or invalid credentials. | Problem |
403 | Authenticated but not allowed (visibility, membership or scope). | Problem |
404 | Resource not found (or hidden from the caller). | Problem |
409 | State conflict (duplicate handle/slug, wrong repo kind, terminal job, ...). | Problem |
502 | Stripe could not be reached or refused the request. Nothing changed. Try again in a moment. | Problem |
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. | Problem |
POST / v1/ billing/ portal
Open the Stripe customer portal
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
| Name | In | Type | Description |
|---|---|---|---|
owner | query | Handle | Your own handle (the default) or the slug of an organization you own. |
Responses
| Status | Description | Body |
|---|---|---|
200 | Where to send the person. | BillingRedirect |
401 | Missing or invalid credentials. | Problem |
403 | Authenticated but not allowed (visibility, membership or scope). | Problem |
404 | Resource not found (or hidden from the caller). | Problem |
409 | State conflict (duplicate handle/slug, wrong repo kind, terminal job, ...). | Problem |
502 | Stripe could not be reached or refused the request. Nothing changed. Try again in a moment. | Problem |
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. | Problem |
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
| Field | Type | Description |
|---|---|---|
received | boolean | |
duplicate | boolean | |
outcome | string | null | What the hub did with the event. |
BillingPriceList
| Field | Type | Description |
|---|---|---|
configured | boolean | True when this hub takes payments. |
free_usd | number | 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_usd | number | The monthly cap a workspace starts with when it adds a payment method. |
prices | BillingPrices |
Billing
| Field | Type | Description |
|---|---|---|
owner | RepoOwner | |
configured | boolean | True when this hub takes payments. |
can_manage | boolean | 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. |
payment | BillingPayment | |
period_start | string (date-time) | |
period_end | string (date-time) | |
usage | BillingUsage | |
cap | BillingCap | |
session_cap_usd | number | null | The default cap on one agent session's spend. |
invoices | array of BillingInvoice | The workspace's invoices, newest first. |
prices | BillingPrices |
BillingCapPut
| Field | Type | Description |
|---|---|---|
monthly_cap_usd | number | null | The cap in US dollars, rounded down to the cent. Send |
BillingCap
| Field | Type | Description |
|---|---|---|
monthly_cap_usd | number | null | The most the period may cost. Null means no cap. |
committed_usd | number | Recorded use plus what work still running may cost. |
remaining_usd | number | null | What is left under the cap. Null without a cap. |
max_cap_usd | number | 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. |
stopping | boolean | True when the cap is reached, so new calls and jobs answer |
BillingRedirect
| Field | Type | Description |
|---|---|---|
url | string | A Stripe page to send the person to. |
BillingPrices
How the hub prices each kind of use.
| Field | Type | Description |
|---|---|---|
model_markup_pct | number | 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_multiplier | number | The GPU provider's price is multiplied by this. |
cpu_multiplier | number | Cloud CPU and the agent's sandbox are the provider's price times this. |
sandbox_rate_usd_per_hour | number | What one hour of the agent's sandbox costs, as billed. |
BillingPayment
Whether the workspace pays for its use, and when it is next invoiced.
| Field | Type | Description |
|---|---|---|
method_on_file | boolean | 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. |
status | string | The state of the monthly billing as Stripe reports it. |
next_invoice_at | string (date-time) | null (date-time) | When the current period ends and the next invoice is made. |
ends_at_period_end | boolean | True when the payment method was removed. Billing stops at |
BillingUsage
| Field | Type | Description |
|---|---|---|
total_usd | number | Use recorded this period at the hub's prices. |
reserved_usd | number | What calls and jobs still running may cost at most. It counts against the cap until each one settles. |
free_usd | number | 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_usd | number | How much of the free amount is used. |
billable_usd | number | Use past the free amount. The next invoice charges it. Zero without a payment method, where use stops at the free amount. |
lines | array of BillingUsageLine | Models, GPU, sandbox and cloud CPU, in that order. A line with no use is left out. |
own_keys | array of BillingUsageItem | AI model calls made with the workspace's own keys. They cost $0 here. |
BillingInvoice
| Field | Type | Description |
|---|---|---|
id | string | Stripe's invoice id. |
number | string | null | |
status | string | |
amount_due_usd | number | |
amount_paid_usd | number | |
usage_usd | number | null | The part of the invoice that is the period's use past the free amount. |
period_start | string (date-time) | null (date-time) | |
period_end | string (date-time) | null (date-time) | |
url | string | null | Stripe's page for the invoice. |
created_at | string (date-time) |
BillingUsageLine
| Field | Type | Description |
|---|---|---|
category | string | |
label | string | |
total_usd | number | |
items | array of BillingUsageItem |
BillingUsageItem
One AI model, one GPU, the sandbox or cloud CPU, over the period.
| Field | Type | Description |
|---|---|---|
key | string | The catalogue id, the GPU tier, |
label | string | |
vendor | LlmVendorId | null | |
calls | integer | null | AI model calls, for a model. |
input_tokens | integer | null | Input tokens read, cached ones included. |
output_tokens | integer | null | |
hours | number | null | Hours of use, for a GPU, the sandbox or cloud CPU. |
cost_usd | number | At the hub's prices. Zero for calls made with your own key. |
list_cost_usd | number | null | What the vendor's list price comes to, for calls made with your own key. |