How Is GPT-6.2 Astra’s Cache Billing Calculated? Use Responses Usage to Verify the 30-Minute, 12-Hour, and 272K Thresholds

Author’s note: This article shows how to split a single GPT-6.2 Astra Responses request into five token buckets — cache reads, 30-minute writes, 12-hour writes, regular input, and output — then use the usage field to recompute the bill, work out whether the cache paid for itself, and catch the 272K whole-request tier switch.

Bottom line first: GPT-6.2 Astra bills caching by the token events that actually happen, not by whether a piece of content was cached at some point. Pull total input I, cache read R, 30-minute write W30, 12-hour write W12, and output O from response.usage; regular input is U = I − R − W30 − W12. On the Standard short tier, the model cost for a single request is (8U + 0.40R + 10W30 + 20W12 + 40O) ÷ 1,000,000 USD.

Three conditions shape the result. First, the write price already is the total input price for those tokens — the regular input price isn’t stacked on top. Second, 30-minute writes break even after a single hit, while 12-hour writes need two hits. Third, once total input passes 272K, every input unit price for the whole request doubles and the output price is multiplied by 1.5 — cached hits get the same increase. Every example below can be recomputed term by term on a calculator; none of the numbers are measured data.

gpt-6-2-astra-prompt-cache-billing-responses-usage-en-image-0


GPT-6.2 Astra Cache Billing Knowledge Map

gpt-6-2-astra-prompt-cache-billing-responses-usage-en-image-1

Diagram note: Start with Section 1 to split a single request into five token types—this is the input for every later decision. Section 2 explains why W30 and W12 show up, and Section 3 uses them to work out whether the cache pays for itself. Section 4 checks whether total input crosses 272K, which determines the unit-price tier for the whole request. Section 5 turns the formulas into runnable code and log fields; if read volume looks abnormal, take the diagnostic branch.

Reading Guide

  1. 1 Billing event split: Read first. It gives the formula and field mapping; every later section uses U, R, W30, and W12.
  2. 2 TTL coverage rules: Explains write duration and overlapping billing, determining how large W30 and W12 are.
  3. 3 Cache payback: Depends on Sections 1 and 2, answers “should I cache this time, and which TTL should I choose?”
  4. 4 272K threshold: Independent of Sections 2 and 3; look it up as needed for long-document requests.
  5. 5 Responses usage reconciliation in practice: Turns the first four sections into runnable code and log fields.

To Know

Term Brief Explanation
Prefix caching Exact-match the beginning of the rendered input; the matched portion is billed at the cache-read price
TTL Minimum cache coverage period; in Responses you can choose 30m (default) or 12h
Cache write This request writes the prefix into the cache and is billed at the write price, which already includes the input price
Breakpoint The position that tells the service “cache up to here”; a single request can have at most four cache writes
Short tier / Long tier If total input is at most 272K, use short-tier unit prices; if it exceeds 272K, the whole request switches to long-tier unit prices
service_tier The service tier that actually handled the request; settlement is based on the returned value

1 How to break down the GPT-6.2 Astra cache bill by billing event

1.1 GPT-6.2 Astra standard rates

All rates below are for gpt-6.2-astra on the OpenAI Responses API at the Standard tier, in USD per million tokens. Both retention periods share the same price for cache-hit reads; only the write price differs.

Billing event Short tier (total input ≤ 272K) Long tier (total input > 272K) Relative to regular input
Regular input U 8 16 1×
Cache read R 0.40 0.80 0.05×
30-minute cache write W30 10 20 1.25×
12-hour cache write W12 20 40 2.5×
Output O 40 60 —

The write price is the easy thing to get wrong. The $10 and $20 figures are the all-in input price for those tokens — the same write tokens aren’t charged an extra $8 regular-input fee on top. A single request can also read an existing prefix, write a newly extended prefix, and bill the remaining suffix as regular input; the bill classifies each portion by what actually happened.

Quick-start tip: If you want to verify these rates without touching your business code, you can send a few requests through APIYI apiyi.com using the OpenAI-compatible interface and plug the returned usage straight into the formulas in this article. Actual charges are based on the prices shown in the platform console.

1.2 Mapping the Responses usage fields

GPT-6.2 Astra’s usage fields already split tokens into all five classes, so you don’t have to estimate hit lengths when you reconcile the bill.

Formula symbol usage field path Description
I usage.input_tokens Total input, including all cache reads and writes
R usage.input_tokens_details.cached_tokens Cache read volume actually billed
W usage.input_tokens_details.cache_write_tokens Total write volume
W30 ...cache_write_tokens_details.ttl_30m_tokens 30-minute write volume
W12 ...cache_write_tokens_details.ttl_12h_tokens 12-hour write volume
O usage.output_tokens Output volume

The official guide states that W30 + W12 = W, and both fields are returned even when they’re zero. Tokens upgraded from short retention to long retention count as writes and are already excluded from R, so U = I − R − W doesn’t double-deduct. Keep the returned service_tier in your logs too, since billing ultimately settles on the actual processing tier and regional price.

1.3 A reproducible example: one request with 12,000 tokens

These input numbers come from the field example in the official caching guide; the output count is assumed for this article: I = 12,000, R = 4,000, W30 = 3,000, W12 = 4,000, O = 2,000.

  1. Regular input: U = 12,000 − 4,000 − 7,000 = 1,000.
  2. The four input components: 8 × 1,000 = $0.008, 0.40 × 4,000 = $0.0016, 10 × 3,000 = $0.03, 20 × 4,000 = $0.08 (all already divided by one million), for a total of $0.1196.
  3. Output: 40 × 2,000 ÷ 1,000,000 = $0.08.
  4. Total: $0.1996.

This counts model tokens only — no tool fees or regional surcharges. Once you send your own requests, recompute using the usage that actually comes back.


2 GPT-6.2 Astra’s 30-Minute and 12-Hour Cache Coverage

2.1 TTL Coverage and Renewal Rules

In Responses, use prompt_cache_options.ttl to set the minimum request-level cache lifetime. The default is 30m, and 12h is also available. You can set an explicit breakpoint separately with prompt_cache_breakpoint.ttl, which either inherits or overrides the request default. Both are only minimum coverage periods—the cache may actually retain data longer.

Renewal and upgrade rules directly affect billing:

  • 30-minute cache hit: The coverage period is updated to at least 30 minutes from this read.
  • 12-hour coverage read with a valid 30-minute cache: The expiration time is the later of the “original expiration time” and “30 minutes after this read”; the 12-hour timer does not restart.
  • Upgrading a valid 30-minute coverage to 12 hours: The relevant tokens are charged the full 12-hour write price, and previously paid write fees are not offset.

Prefix matching is based on the exact rendered content. Fixed rules, examples, reference material, and stable tool definitions should go first; current files and questions should go later. A cacheable prefix requires at least 1,024 visible input tokens; hidden system content doesn’t count. GPT-6.2 places top-level instructions after input, and resending them is charged as ordinary input, so reusable specifications are better written as developer messages at the beginning.

2.2 Billing for Breakpoints and Overlapping Writes

If you only want to cache a stable prefix, set prompt_cache_options.mode to explicit, set breakpoints on supported content blocks, and put the changing suffix after the last breakpoint. For a knowledge base, you can set the shared specification in the first segment to 12h and the session material in the latter segment to 30m. If a token is covered by multiple writes in a single request, it’s billed only at the longest of those periods.

In the official example, two breakpoints are at the 2,000th and 5,000th tokens, and neither segment was previously cached:

  • First segment 12h, second segment 30m: The first 2,000 tokens are covered by two writes, so they’re billed at the longest period, 12h; the latter 3,000 tokens are billed at 30m. The cost is 20 × 2,000 + 10 × 3,000 = 70,000, which divided by one million is $0.07.
  • First segment 30m, second segment 12h: The latter 12h write covers the entire 5,000-token span, so all of it is billed at the long write rate, for a cost of $0.10.

The breakpoint positions are the same, but the price is determined by the longest coverage. Also, a single request can create at most four cache writes, and using implicit breakpoints takes up one of those slots.


3 GPT-6.2 Astra Caching: When Does It Break Even?

3.1 Break-Even Hit Count for a Single Prefix

Use “all identical requests processed as regular input” as the baseline. A short write costs $2 more per million tokens than regular input (10 − 8 = 2), and a long write costs $12 more (20 − 8 = 12). After that, every full hit saves $7.60 per million tokens (8 − 0.40 = 7.60).

So if you write a fixed prefix once and then get all hits afterward, a 30-minute write breaks even after 1 hit (7.60 > 2), while a 12-hour write needs 2 hits to break even (7.60 × 2 > 12). If you only get partial hits, calculate it based on cumulative read volume. For example, with a 20,000-token write, the extra cost of a short write is $0.04, so you need to read about 5,263 tokens of the same kind cumulatively to offset it; the extra cost of a long write is $0.24, so you need to read about 31,579.

3.2 Three Calls: 30-Minute vs. 12-Hour Writes

gpt-6-2-astra-prompt-cache-billing-responses-usage-en-image-2

Scenario (20,000-token prefix, 3 calls) Calculation Prefix cost (USD)
No caching, all regular input 3 × 0.16 0.48
30m: one write, next 2 hits 0.20 + 2 × 0.008 0.216
30m: two writes, 1 hit 0.40 + 0.008 0.408
12h: one write, next 2 hits 0.40 + 2 × 0.008 0.416
Request interval crosses short coverage; all three 30m writes 3 × 0.20 0.60

This table shows that a 12-hour write isn’t automatically cheaper. A long write is only worth it when the 30-minute approach would keep rewriting; even with two short writes and one hit, $0.408 is still slightly lower than $0.416. A longer request interval can be a clue to consider a long write, but the read and write records should be the final arbiter.

3.3 Should You Pad a Shared Prompt Under 1,024 Tokens?

A shared prompt under 1,024 tokens can’t be cached. The official method is as follows: assume the original prompt is L tokens long and used across ten requests, each billed as regular input, for a total of 10L. If you pad it with useful stable material to exactly 1,024 tokens, then do one short write and nine full hits, the ten-request total is equivalent to 1,024 × (1.25 + 9 × 0.05) = 1,740.8 regular input tokens.

When 10L ≥ 1,740.8—that is, when the original prompt is at least 175 tokens—the padded approach has a lower prefix cost. This crossover depends on Astra’s 0.05× read price and the assumption of nine hits; changing the model or the number of hits will change the result.


4 GPT-6.2 Astra’s 272K Whole-Request Tier Switch

4.1 Tier-Switch Rules

When a single request’s total input exceeds 272K tokens, the unit prices for standard input, cache reads, and both write types all double for the entire request, and the output unit price is multiplied by 1.5. The decision is based on the total input I, which includes all cache reads and writes. Even if the overwhelming majority of the input is a long document that hits the cache, the total input still governs — the exact boundary is defined by the model card.

4.2 Two Contrasting Requests That Differ by Only 3,000 Tokens

Both requests read 200,000 from cache, write 8,000 short and 2,000 long, and output 2,000 tokens — only the standard input differs. Both use the Standard tier and exclude regional surcharges and tool fees.

Item Request A (I = 270,000, short tier) Request B (I = 273,000, long tier)
Standard input 60,000 × 8 → 0.48 63,000 × 16 → 1.008
Cache read 200,000 × 0.40 → 0.08 × 0.80 → 0.16
Short write 8,000 × 10 → 0.08 × 20 → 0.16
Long write 2,000 × 20 → 0.04 × 40 → 0.08
Output 2,000 × 40 → 0.08 × 60 → 0.12
Total (USD) 0.76 1.528

The extra 3,000 tokens of standard input are worth only $0.024 on their own (at the short tier), yet the difference reaches $0.768 — mostly from re-pricing the entire request. The hit volume didn’t change at all, and the cache-read cost still jumped from $0.08 to $0.16. For long-document tasks close to the threshold, trimming trailing supplementary material is often more cost-effective than optimizing hit rate.


5 Verify GPT-6.2 Astra Cache Billing with Responses Usage

5.1 Minimal Billing-Verification Code

The code below sends a single request, extracts five token categories from usage, automatically decides whether it falls in the short or long tier, and computes the model cost. Cache parameters are passed in through extra_body, and the field names match those in Section 1.2.

import openai

client = openai.OpenAI(
    api_key="YOUR_API_KEY",
    base_url="https://api.apiyi.com/v1"  # APIYI OpenAI-compatible endpoint
)

resp = client.responses.create(
    model="gpt-6.2-astra",
    input=[
        {"role": "developer", "content": "(stable instructions placed at the top, at least 1,024 tokens)"},
        {"role": "user", "content": "this question goes at the end"},
    ],
    extra_body={"prompt_cache_options": {"ttl": "30m"}},
)
u = resp.model_dump()["usage"]
print(u, resp.model_dump().get("service_tier"))
View the complete billing-verification function
import openai

RATES = {  # USD / million tokens, GPT-6.2 Astra Standard
    "short": {"U": 8, "R": 0.40, "W30": 10, "W12": 20, "O": 40},
    "long":  {"U": 16, "R": 0.80, "W30": 20, "W12": 40, "O": 60},
}
THRESHOLD = 272_000  # exact boundary per the official model card

def split_usage(usage: dict) -> dict:
    d = usage.get("input_tokens_details") or {}
    wd = d.get("cache_write_tokens_details") or {}
    I = usage["input_tokens"]
    R = d.get("cached_tokens", 0)
    W30 = wd.get("ttl_30m_tokens", 0)
    W12 = wd.get("ttl_12h_tokens", 0)
    W = d.get("cache_write_tokens", W30 + W12)
    assert W == W30 + W12, "write totals don't match, check the fields"
    return {"I": I, "R": R, "W30": W30, "W12": W12,
            "U": I - R - W, "O": usage["output_tokens"]}

def model_cost(t: dict) -> tuple:
    tier = "long" if t["I"] > THRESHOLD else "short"
    r = RATES[tier]
    cost = sum(r[k] * t[k] for k in ("U", "R", "W30", "W12", "O")) / 1_000_000
    return tier, round(cost, 6)

client = openai.OpenAI(
    api_key="YOUR_API_KEY",
    base_url="https://api.apiyi.com/v1"  # call everything through APIYI
)

resp = client.responses.create(
    model="gpt-6.2-astra",
    input=[
        {"role": "developer", "content": "(stable instructions)"},
        {"role": "user", "content": "(the question for this request)"},
    ],
    extra_body={"prompt_cache_options": {"ttl": "12h"}},
)
data = resp.model_dump()
tokens = split_usage(data["usage"])
tier, cost = model_cost(tokens)
print({"service_tier": data.get("service_tier"), "band": tier,
       "tokens": tokens, "cost_usd": cost})

# Self-check with the official example from Section 1.3: should output ('short', 0.1996)
print(model_cost({"I": 12000, "R": 4000, "W30": 3000,
                  "W12": 4000, "U": 1000, "O": 2000}))

Hands-on tip: Start by running the self-check with the official example on the last line to confirm the formula outputs $0.1996, then hook it up to real requests. Using APIYI’s free test credits at apiyi.com, run a few requests with short and long intervals, and you’ll be able to watch W30, W12, and R change.

5.2 Billing Audit Logs and Cache-Miss Diagnostics

gpt-6-2-astra-prompt-cache-billing-responses-usage-en-image-3

A usable billing audit record should include: request send time, model identifier, service tier, I, R, W30, W12, O, the short/long input tier, and the cost subtotal. When comparing the same task over a short window versus across time periods, first figure out whether the cost increase comes from a miss, a coverage upgrade, or crossing the threshold tier — then look at the per-group hit rate. You can compute the hit rate per business line or per date by dividing total cache read volume by total input volume, but keep the write cost alongside it; otherwise you’ll overestimate the cache benefit.

If two requests look identical yet read volume drops, pick a recently completed response ID in the same organization that you expect to be reusable, set prompt_cache_options.comparison_response_id on the follow-up request, and inspect the returned prompt_cache_diagnostics. The diagnostics report the reason for the miss — differences in model, tools, service tier, or input — but they’re for diagnosis only: actual read volume still comes from usage, and the original response content isn’t loaded automatically. The names, order, or parameter structure of function tools can shift early in the request, so comparing the rendered prefix is more effective than comparing only the user text.


GPT-6.2 Astra Cache Billing FAQ

Q1: What is GPT-6.2 Astra’s cache billing?

It’s a bill that splits a single request’s input into four categories — cache reads, 30-minute writes, 12-hour writes, and regular input — and prices the output separately. You can read the token count for each category straight from the `usage` field of the Responses API.

Q2: What’s the difference between the 30-minute cache and the 12-hour cache?

Both have the same cache-hit read price: $0.40 per million tokens. The difference is the write price — $10 versus $20 — and how long the coverage lasts. A 30-minute write pays for itself after a single hit; a 12-hour write needs two.

Q3: When are the rates in this article valid?

The rates and rules are based on the official model card, pricing table, and caching guide verified on 2026-11-27. Prices may change, so re-check the official pages and your platform’s pricing before you audit your bill.

Q4: Which scenarios are best suited to the 12-hour cache?

Shared prefixes that are long-lived and stable, where calls are often more than 30 minutes apart — team-level knowledge base conventions, fixed tool definitions, and the like. If your logs show frequent rewrites with the 30-minute option, it’s worth considering a switch to 12 hours.

Q5: How can I quickly verify my own cache billing through the API?

Register at APIYI apiyi.com and get an API key, set `base_url` to `https://api.apiyi.com/v1`, run the code in section 5.1, and plug the returned usage into the formula. The platform offers free trial credit to new users, which makes it a good way to validate with a small test first.

Q6: Why does the bill suddenly double when the hit rate is high?

The most common cause is total input crossing 272K: the whole bill flips to the long tier, and the cache read price goes from 0.40 to 0.80. The next most common cause is 30-minute coverage being upgraded to 12 hours, which has to be re-billed at the full long-write price, with the original write fee not credited.

Q7: What are the known limitations of cache billing?

A cacheable prefix needs at least 1,024 visible input tokens, a single request allows up to four cache writes, and the top-level `instructions` don’t participate in cache billing. Also, TTL is only a minimum coverage period — it doesn’t guarantee an exact expiry time — so payback estimates should be based on actual read/write records.


Leave a Comment