Astra API costs from usage to accepted work
Updated 2026-09-05
Account for ordinary input, cache reads, cache writes and output separately. Use the current official rate card and a complete request ledger to estimate a task.
Choose the billing system before choosing a rate
Direct Astra API requests use OpenAI Platform billing. ChatGPT-authenticated Codex work uses subscription or workspace allowances and credits. OpenAI publishes these separately, so a Codex credit rate is not a dollar price per API token and an included subscription turn is not an API receipt.
For direct requests, open the official API pricing page and select the applicable gpt-6-astra rates for the service tier, context band and processing arrangement. Keep the rate-card URL and observation date with your estimate. Build the calculation from request-level usage, then compare the total with your Platform usage records and bill. This makes differences in rate selection or missing requests easier to locate.

Capture the exact Responses usage fields
The official prompt-caching guide documents input_tokens, input_tokens_details.cached_tokens and input_tokens_details.cache_write_tokens. Cached reads and cache writes are separate categories within input, so subtract both before calculating ordinary input. Assuming every uncached token has the ordinary input rate can understate a request that writes a cache.
The reasoning guide documents output_tokens and output_tokens_details.reasoning_tokens. Reasoning tokens are included in output usage; do not add them again as another billed token category. Keep total_tokens as a usage total, not a count to multiply by one blended rate. Record the full usage object so later reconciliation does not depend on an incomplete text-only log.
| Responses field | Meaning | Accounting treatment |
|---|---|---|
| usage.input_tokens | Total input tokens | Split ordinary input, cache reads and writes |
| usage.input_tokens_details.cached_tokens | Cached input tokens | Apply the cached-input rate |
| usage.input_tokens_details.cache_write_tokens | Input tokens written to cache | Apply the cache-write rate |
| usage.output_tokens | Output tokens including reasoning | Apply the output rate once |
| usage.output_tokens_details.reasoning_tokens | Reasoning within output | Retain as a diagnostic subset |
| usage.total_tokens | Total input and output usage | Retain for reconciliation |
Calculate the token subtotal without double counting
Let I be input tokens, C cached input, W cache-write input and O output tokens. Ordinary input is I - C - W. With rates R_input, R_cached, R_write and R_output quoted in the same currency per million tokens, the token subtotal is ((I - C - W) * R_input + C * R_cached + W * R_write + O * R_output) / 1,000,000.
The offline function below accepts observed usage and a separately selected rate card. Its rate names are application variables, not API fields. It returns null for missing or inconsistent inputs instead of silently treating unknown usage as free. The result covers tokens only, not tools, taxes or other bill items.
function estimateTokenCost(usage, rates) {
const I = usage?.input_tokens
const C = usage?.input_tokens_details?.cached_tokens
const W = usage?.input_tokens_details?.cache_write_tokens
const O = usage?.output_tokens
const tokens = [I, C, W, O]
const prices = [rates?.input, rates?.cached, rates?.write, rates?.output]
if (!tokens.every(n => Number.isSafeInteger(n) && n >= 0)) return null
if (!prices.every(n => Number.isFinite(n) && n >= 0)) return null
if (C > I || W > I - C) return null
const subtotal = ((I - C - W) * rates.input
+ C * rates.cached + W * rates.write
+ O * rates.output) / 1_000_000
return Number.isFinite(subtotal) ? subtotal : null
}Resolve context and service-tier rules per request
Astra's official pricing distinguishes ordinary input, cached input, cache writes and output, with different context bands and service tiers. Resolve those rules for each request before supplying rates to the formula. Do not apply a multiplier again if you already selected a rate-card row that includes it.
Keep service-tier and processing metadata with the response and compare them with what was requested. Do not reuse Codex speed or credit multipliers for a direct API calculation: those belong to a different product price schedule. For unusual processing arrangements, reconcile against the applicable provider terms. A correct token formula with the wrong rate basis is still an incorrect cost estimate.
Separate token estimates from complete task costs
A task can require several model requests, tool calls and revisions. Add the token subtotal for each recorded request, then add separately billed provider tools or services according to their actual usage and pricing. A model's ability to call a tool does not mean that tool is included at no additional charge.
Keep infrastructure, asset-generation expenses and human review time in separate categories. Attach service receipts and the time period they cover, and allocate shared costs consistently across tasks. For a game, localization batch or research task, state which components the total includes. Separate taxes and currency conversions from token rates so you can reconcile both the usage subtotal and the final amount paid.
| Cost component | Evidence to retain | Combination rule |
|---|---|---|
| Model tokens | Responses usage plus applicable API rates | Sum request subtotals |
| Provider tools or services | Tool usage and official pricing category | Add separately billed items |
| Other runtime or assets | Service receipts and attribution | Report in separate categories |
| Human review | Recorded time and stated valuation method | Keep distinct from API spend |
Keep retries, incomplete work and missing usage visible
OpenAI's reasoning guide warns that incomplete generation can consume input and reasoning tokens without producing visible text. Count usage that is actually returned even when the result fails your acceptance check. Do not restrict the ledger to successful final answers or estimate spend from answer length alone.
For each attempt, retain response identity, model, status, usage and the task it belongs to. Reconcile duplicates before summing. If a connection fails and no usage arrives, mark that attempt unresolved until provider records clarify it; neither zero cost nor a full success is established. Bound retries so a temporary fault cannot create an unreviewed series of billable attempts.
Budget around accepted results and bounded work
Define the unit of accepted work before measuring it: a tested code change, an approved product-locale record or a source-linked research note. Cost per accepted unit is the attributable task cost divided by the accepted-unit count, only when that count is nonzero. Report the sample and unresolved usage alongside the ratio.
Use a request ceiling, bounded retries and a task stop condition together. The documented max_output_tokens field constrains generation, including reasoning, but is not a complete currency budget for a multi-request task. Set account controls and track accumulated spend too. Smaller context or different reasoning settings should be evaluated against the same acceptance criteria, not advertised as guaranteed savings.
Provider availability and evidence: September 5, 2026
The usage fields and formula in this guide come from official OpenAI documentation. No Astra task cost or runtime was measured for the article. On September 5, 2026, the public APIsRouter pricing endpoint returned HTTP 200, success: true and 34 models without Astra or GPT-6, so there is no APIsRouter Astra quote here.
Use OpenAI's current pricing for direct Astra requests and the live APIsRouter catalog for its own offerings. A provider comparison needs matching tasks, actual model identity, accepted outputs, complete usage and applicable rates. Keep those records with the calculation so readers can distinguish an estimate from a reconciled task bill.
FAQ
What is the current Astra API price?
Use the official OpenAI API pricing page for gpt-6-astra. Select the service tier and context band that apply to your request, including separate cache-read and cache-write rates.
Are reasoning tokens charged in addition to output_tokens?
Reasoning tokens are included within output usage. Apply the output rate to output_tokens once; retain output_tokens_details.reasoning_tokens for diagnosis rather than adding it again.
How do cache writes affect the formula?
Subtract cached_tokens and cache_write_tokens from total input to obtain ordinary input. Price ordinary input, cache reads and cache writes separately using the applicable official rates.
Is a timeout or incomplete answer free?
Not necessarily. Incomplete generation can consume tokens, and a timeout can leave billing evidence unresolved. Keep returned usage and reconcile missing records instead of assigning zero cost.
How much does an Astra task cost through APIsRouter?
There is no quote from the September 5, 2026 check because Astra was absent from the catalog. Check current offerings; use OpenAI pricing for direct Astra estimates.