This page applies to accounts on compute-unit plans. If your account is billed by request count, Rate Limits & Connection Limits describes how your usage is measured. Your billing page shows which applies to you.
What a Compute Unit Is
A compute unit is the unit every Codex operation is priced in. A typical query costs a few compute units, a subscription message costs one, and lightweight operations cost a fraction of one, so costs are shown with up to six decimal places. The base cost of every documented operation is listed on Compute Unit Costs, and your billing page shows the same table with any custom prices your account has. Rate limits are separate from compute units and do not change with the size of your plan: free accounts get 5 requests per second and paid plans get 300 requests per second, the same as request-based plans. See Rate Limits & Connection Limits for the connection limits.How a Request Is Priced
Pricing is flat and deterministic: two identical requests cost the same number of compute units. Response size and processing time are measured and reported, but they do not change the price of a query or a mutation.Queries and mutations
- Each root field is billed its base cost every time it is called. A request that sends
filterTokensandgetDetailedTokenStatstogether costs the same as sending them separately. Aliased root fields are each billed. - Some response types add a per-object cost. For example, every token returned by
filterTokensadds the per-object cost of the token type, so asking for 50 tokens costs more than asking for 10. A few nested fields carry their own cost each time they are resolved. Both are listed under Response types and fields. - Mutations are priced the same way and are shown as their own category on the usage page.
Errors are free, except NOT_FOUND
A root field whose response carries a GraphQL error is not charged and does not count as a request. Root fields in the same request that succeeded are billed as if they had been sent alone, so a partial response only bills the fields that returned data. A request that fails before execution (a parse or validation error) costs nothing.
One error is charged: NOT_FOUND. The lookup ran and found nothing, so the root field is billed and counted as a request like any other answer.
Introspection queries are free. They cannot be combined with data fields in the same request; the API rejects the request with Cannot mix introspection queries with data queries in the same request. Please send introspection and data queries separately.
Subscriptions
A subscription is billed for what it delivers and for how long it stays open:
An idle subscription still accrues the open-time cost, so close subscriptions you no longer need. Optimization covers subscription lifecycle management.
Webhooks
Only deliveries your endpoint accepts are billed, the same as on request-billed plans.
Creating and deleting webhooks are mutations and carry the mutation base cost listed on Compute Unit Costs.
Allowances and Billing Periods
Every account has an allowance of compute units for its period:
Plans and prices are on the pricing page and in the dashboard. Usage inside the allowance is included in the plan price.
You receive an email when your usage crosses 50% and 80% of the allowance, and again at 100%. What happens at 100% depends on auto-scale.
Auto-Scale
Auto-scale is a setting on paid plans, under Settings → Billing Settings in the dashboard. It decides what happens when you use your whole allowance before the period ends:- Auto-scale on — requests keep working. Usage beyond the allowance is billed as overage at your plan’s overage rate per 1 million compute units, shown on your billing page. Large overage can be charged during the period (see Overage charges during the billing period); the rest appears on the invoice for that period. You receive a further email at 150% of the allowance.
- Auto-scale off — usage stops at the allowance. When usage reaches 100%, every API key on the account is paused until the period rolls over or you change plan, and requests are rejected with HTTP 403 (see Errors & Retries). Nothing beyond the allowance is billed. Enforcement runs asynchronously, so usage can briefly overshoot the allowance; the overshoot is not billed.
Overage charges during the billing period
On self-serve plans with auto-scale on, you do not wait until the end of the period to pay for large overage. Each time your overage in a period grows by another 1 million compute units, we can charge your payment method for all of the overage so far in that period, less what we already charged in that period. Plans by agreement are invoiced as agreed.- Each charge is a separate invoice, charged to the payment method on your subscription. The billing page shows the total charged so far this period.
- When a charge is paid, the same amount is credited on your next subscription invoice, so you never pay twice for the same overage. The total that you pay for a period does not change.
- If a charge fails, or your bank asks you to approve it and you do not, every API key on the account is paused at once. Pay the invoice from the billing page (Pay invoice) to restore access; see Errors & Retries.
- If you upgrade during the period, the credit applies to the upgrade invoice.
Unpaid Invoices
If an invoice cannot be collected, every API key on the account is paused and requests are rejected with HTTP 403 until the invoice is paid. Pay it from the billing portal (Pay invoice on the billing page); access is restored by the successful payment and by nothing else, so a new billing period does not lift the pause.The Usage Page
The usage page shows your compute units for the current period and for any range you pick:- A usage card with the compute units used against the allowance and the percentage used.
- Charts of compute units over time.
- Breakdowns by query, mutation, subscription, and webhook, ranking each operation (or webhook type) by the compute units it consumed and its share of the selected usage.
Checking Usage from the API
TheapiUsage query returns your account’s usage for the current period against your allowance. It is free, and it still works when the account is over its limit, so you can call it from your own monitoring.
unitisCOMPUTE_UNITSon compute-unit plans andREQUESTSon request-based plans.used,limit,remainingandbreakdownare in that unit, returned as strings.limit,remainingandpercentUsedare null when the plan has no quota.percentUsedcan go above 100 when auto-scale is on.- The numbers are refreshed by the usage pipeline, not on every request.
updatedAtsays when they were last refreshed.
Estimating Usage in the Explorer
The explorer shows what your queries will cost before you build them into your app:- CU meter shows each query’s compute-unit cost under the response, with the equivalent number of requests. Add queries and streams to a monthly estimate, and it is matched against the self-serve plans.
- Stream meter counts messages while a subscription runs and projects them per hour and per 30 days, in compute units and in requests.
Checking the Cost of a Request
Add theusageData field to any query to see what that request cost. The field itself is free.
total.computeUnitsis the compute units charged for the request that carried the field.itemslists each priced component:resourceis the operation or field (for examplefilterTokens), andentityTypeis set for per-object costs (for example the token type returned byfilterTokens).countis the number of billable units, not requests: 1 for a field that was called once, or the number of objects for a per-object cost.bytesanddurationMsare measured for reference and do not affect the price under standard pricing.- All values are returned as strings.
usageData reports zeros.