Developer

Billing API

Read the balance and start purchases from your own tools.

Most teams add funds from the Billing page. These endpoints let your own tools read the balance and start a purchase. They need the billing:read and billing:write scopes, which new keys leave off unless you choose them.

Read the balance

GET/v1/billing/credits

Returns available_credits for the account that owns the key. 1,000,000 credits equal $1.00. Requires billing:read.

Read pricing and limits

GET/v1/billing/checkout-config

Returns the credit rate, the starting credit, the per million token prices, and the smallest and largest purchase. Requires billing:read.

Start a purchase

POST/v1/billing/checkout-sessions

Creates a hosted checkout page and returns its url. Send the buyer there. Funds are added once the payment is confirmed, never from the redirect alone. Purchases range from $5.00 to $1,000.00. Requires billing:write.

Checkout parameters
ParameterDescription
amount_usdstring or numberAmount in US dollars, such as 25.00. Send this or amount_cents, not both.
amount_centsintegerAmount in cents, such as 2500.
success_urlstringWhere to send the buyer after payment. Defaults to the console Billing page.
cancel_urlstringWhere to send the buyer if they cancel. Defaults to the console Billing page.

Current prices

  • Core chat: $2.00 per million input tokens, $10.00 per million output tokens.
  • Grounded chat with citations: $5.00 per million input tokens, $25.00 per million output tokens.