GPT-6 Astra Prompt Caching Guide: Explicit Breakpoints, Cache Keys, 30-Minute TTL, and Long-Context Cost Control

GPT-6 Astra Prompt Caching Guide: Explicit Breakpoints, Cache Keys, 30-Minute TTL, and Long-Context Cost Control
GPT-6 Astra Prompt Caching Guide: Explicit Breakpoints, Cache Keys, 30-Minute TTL, and Long-Context Cost Control

Prompt caching is now a first-order design problem for GPT-6 Astra

GPT-6 Astra changes the economics of long-context application design because OpenAI documents a 1,050,000-token context window for the model, with up to 922,000 input tokens and up to 128,000 output tokens. That capacity is useful for enterprise knowledge packs, large codebases, multi-file legal reviews, tool-heavy agents, and long-running support conversations, but it also makes repeated prefixes expensive if every request resends the same system policy, tool schema, retrieval bundle, or project state as uncached input. Prompt caching is the OpenAI API mechanism that can reduce those repeated-prefix costs when the beginning of a request remains stable across calls.

In practical terms, prompt caching stores a reusable representation of a prompt prefix, not the assistant’s final answer. The cacheable material is the stable beginning of the request: for example, your developer instructions, product taxonomy, compliance rules, tool definitions, canonical examples, or the earlier portion of an append-only conversation. When a later request begins with the same qualifying prefix and is routed to infrastructure that can reuse it, OpenAI can bill matching tokens as cached input rather than as ordinary uncached input. This makes cache design different from response memoization: cached prompt tokens still let the model produce a new answer for the current suffix, tool result, user question, or latest conversation turn.

For GPT-5.6 and later models, including GPT-6 Astra, OpenAI documents a minimum cacheable visible prefix of 1,024 tokens. A short request below that visible-token threshold should be planned as fully uncached, even if it repeats exactly. The operational implication is simple: do not spend engineering effort building cache-breakpoint logic for tiny prompts; start with prompts that have a stable prefix of at least 1,024 visible tokens and that are called repeatedly enough for read savings to outweigh write costs.

The 1,024-token rule also affects how teams organize prompts. A 700-token policy plus a 200-token tool description plus a 100-token user query may look repetitive to a developer, but it does not reach the documented minimum cacheable visible prefix. A better design for a cache-sensitive workflow is often to place stable instructions, fixed examples, durable tool definitions, and reusable domain context before volatile user-specific material, so the repeated prefix crosses the minimum threshold before the request begins to vary. This is a prompt architecture decision, not a formatting preference.

For Prompt Caching Cost Reduction, Prompt Caching Strategies: 89% Cost Reduction Playbook is the most relevant adjacent resource. The prompt-caching strategy playbook explains why repeated stable prefixes can materially reduce token expenditure, giving the broader economic foundation for Astra’s cache-write and cache-read model.

What OpenAI bills: uncached input, cache writes, and cache reads

OpenAI’s current pricing table separates three input-side states that matter for Astra: uncached input tokens, prompt-cache write tokens, and cached-input read tokens. Uncached input is the normal case for tokens that are not reused from an existing prompt cache entry. A cache write occurs when qualifying prompt-prefix tokens are stored for possible reuse. A cache read occurs when a later request reuses a matching cached prefix and the reused tokens are billed at the cached-input rate.

Input state What it means operationally GPT-6 Astra Standard short-context rate
Uncached input Tokens are processed normally because there is no qualifying reusable cache entry for that portion of the prompt. $10 per million input tokens
Cache write Qualifying prefix tokens are written into the prompt cache so later requests may reuse them. $12.50 per million cache-write tokens
Cache read Matching prefix tokens are reused from prompt cache and billed as cached input. $1 per million cached-input tokens
Output Generated response tokens are billed separately from input-side caching. $50 per million output tokens

For GPT-5.6 and later, OpenAI describes the general relationship as cache writes costing 1.25× uncached input and cache reads costing 0.1× uncached input. For Astra’s Standard short-context pricing, that maps directly to $10 per million uncached input tokens, $12.50 per million cache-write tokens, and $1 per million cached-input tokens. The important tradeoff is that the first reusable request may cost more than ordinary input because it writes the cache, while subsequent matching requests can be much cheaper on the reused prefix.

Here is the decision rule most teams should use during design: cache prefixes that are large, stable, and reused; do not optimize prefixes that are small, constantly reordered, or rarely repeated. If a 50,000-token project manual is sent once, a cache write is just an added input-side cost. If the same 50,000-token manual prefixes hundreds of requests from the same application workflow, cached reads can dominate the economics. The break-even point depends on the number of future hits, how many prefix tokens are actually reused, and whether the request crosses Astra’s long-context pricing threshold.

For GPT-6 Astra Pricing, GPT-5.6 Sol vs Terra vs Luna: Complete Pricing and Performance Guide for Developers is the most relevant adjacent resource. The GPT-5.6 Sol, Terra, and Luna pricing guide provides the prior-generation rate baseline needed to understand why Astra’s cache design and model routing deserve separate cost analysis.

Astra’s long-context threshold can change the whole request’s rate

OpenAI’s pricing notes for GPT-6 Astra include a key threshold: requests above 272,000 input tokens are billed at long-context rates for the full request. Under Standard pricing, that means $20 per million input tokens, $2 per million cached-input tokens, $25 per million cache-write tokens, and $75 per million output tokens. This is not a marginal surcharge applied only to tokens after 272,000; the documented pricing states that requests above the threshold are billed at the higher rates for the full request.

GPT-6 Astra Standard pricing state Short-context request Request above 272,000 input tokens
Uncached input $10 per million tokens $20 per million tokens
Cached input read $1 per million tokens $2 per million tokens
Cache write $12.50 per million tokens $25 per million tokens
Output $50 per million tokens $75 per million tokens

This threshold makes prefix design especially important for Astra. A team that casually prepends a 300,000-token repository digest to every request may move the entire call into the higher pricing tier, even if the user’s actual task is small. Prompt caching can reduce the rate on reused prefix tokens, but it does not remove the need to budget total input size. A cache-conscious architecture should still trim irrelevant files, defer optional tool definitions, avoid duplicating retrieved passages, and reserve enough room for reasoning and output.

Astra’s documented maximum output size is 128,000 tokens, and OpenAI’s reasoning guidance recommends reserving substantial budget during early experimentation for reasoning and output. For long-context workflows, this means the input planner should not fill the context window simply because it exists. If an application sends hundreds of thousands of input tokens and also requests a large answer, cost control must account for input tiering, cache write/read state, and output pricing together. A cheap cached prefix can still be paired with an expensive generated output if the task asks Astra to produce a long report, codebase patch, or multi-document analysis.

What a cacheable prefix should contain

A cacheable prefix should contain information that is stable across a series of requests and useful before the request-specific suffix. Common candidates include durable system and developer instructions, compliance policies, organization style guides, rubric definitions, tool schemas, stable retrieval bundles, canonical examples, and the earlier portion of an append-only conversation. Common non-candidates include timestamps, request IDs, per-user personalization, randomized ordering, volatile search results, and changing tool lists inserted near the top of the prompt.

The order of content matters because prompt caching works on prefixes. If a volatile value appears before stable material, it can prevent reuse of everything after it as part of the same exact prefix. For example, placing a changing “current user task” block before a 40,000-token policy pack is hostile to caching; placing the policy pack first and appending the changing user task afterward is cache-friendly. The same principle applies to tool definitions: stable tool configuration belongs before volatile tool outputs, while optional tools that are not needed for a task should be deferred rather than repeatedly included in the prefix.

Operational warning: a prompt cache is not a semantic similarity cache. Treat the prefix as needing stability in content and ordering. Rewording instructions, re-sorting JSON properties, rotating examples, changing tool definitions, or injecting per-request metadata near the beginning can reduce cache reuse even when the prompt “means” the same thing to a human reviewer.

OpenAI documents both implicit and explicit breakpoints for prompt caching. An implicit breakpoint lets the platform identify cacheable prefix boundaries without the application marking each one. An explicit breakpoint is a developer-controlled boundary that tells the cache system where a reusable prefix should end. The practical value of explicit breakpoints is predictability: teams can separate “stable prefix to reuse” from “volatile suffix to process normally” instead of relying only on automatic boundary selection.

Use explicit breakpoints where the boundary is obvious and valuable: after a stable enterprise policy pack, after a fixed set of tool definitions, after a static repository map, or after the durable part of a conversation before the latest user turn. Avoid scattering breakpoints after every small block, because the minimum cacheable visible prefix is still 1,024 tokens and because operational complexity rises when many fragments have to remain stable. In most production applications, the first high-value breakpoint is the one after the largest stable block that repeats across requests.

30-minute TTL changes how you plan request sequences

For applications migrating from GPT-5.5 or earlier, OpenAI’s Astra guidance says to replace the older `prompt_cache_retention` approach with `prompt_cache_options.ttl: “30m”`. The documented 30-minute TTL means cache planning should be tied to user sessions, job bursts, and agent loops that naturally reuse the same prefix within a short window. A customer-support triage session, a code-review loop over one repository, or a document-analysis batch can benefit if repeated calls reuse the same prefix before the cache entry expires.

{
  "model": "gpt-6-astra",
  "prompt_cache_options": {
    "ttl": "30m"
  }
}

The snippet above is a minimal configuration example showing the documented TTL value, not a complete request template. In a real application, the surrounding request structure depends on the Responses API design, the input format, and any tools used by the workflow. The important migration point is the field family: for Astra-era applications, design around `prompt_cache_options.ttl` rather than older retention syntax.

A 30-minute TTL also creates a batching incentive. If an application needs to ask ten questions against the same large document pack, it is usually more cache-friendly to run those questions as a coordinated sequence than to spread them across hours with different prompt construction logic. This does not mean forcing all work into one oversized request; it means keeping stable prefixes stable and reusing them while the cache entry is eligible. For agent systems, the safest pattern is often append-only conversation state: preserve the stable prefix, append new observations and tool results, and avoid rewriting earlier instructions midstream.

Cache keys help routing, but they are not a hit guarantee

OpenAI documents deterministic `prompt_cache_key` sharding as an optimization method. The point of a cache key is to improve the probability that related requests reach infrastructure with a matching cache entry. It is not a contractual guarantee that every request with the same key will hit cache, and applications should not make correctness depend on a cache read. Correctness must come from the full prompt content sent to the API; caching should be treated as a billing and latency optimization where available.

A practical key strategy is to shard by the durable artifact that defines the prefix, such as an organization ID plus policy-version ID, a repository ID plus commit hash, or a document-collection ID plus ingestion version. Do not shard only by user ID if many users share the same stable prefix, because that can fragment reuse. Do not shard by highly volatile values such as timestamps or request UUIDs, because that defeats the purpose of routing related calls together. The key should identify the reusable prefix family, not the individual request.

Astra’s launch-specific API guidance also matters for cache-safe workflows because OpenAI documents `configuration_update` items that can change reasoning effort during a conversation while preserving the prompt prefix for caching. That is useful when an agent starts with low or medium reasoning for simple steps and later escalates reasoning for a harder decision without rebuilding the stable prefix. The recommendation is to treat reasoning changes as configuration changes where supported, rather than rewriting the top of the prompt with new instructions that accidentally invalidate prefix stability.

The core design principle for GPT-6 Astra prompt caching is therefore straightforward: front-load stable, reusable, sufficiently large visible-prefix content; append volatile task data later; mark valuable boundaries deliberately; use the documented 30-minute TTL for bursty reuse; and budget cache writes, cache reads, uncached input, and output separately. Astra’s 1.05M-token context window gives teams more room to include the right context, but the published pricing model makes careless repetition visible on the bill.

Designing cache breakpoints for Astra requests

GPT-6 Astra Prompt Caching Guide: Explicit Breakpoints, Cache Keys, 30-Minute TTL, and Long-Context Cost Control — architecture and implementation visual

For GPT-6 Astra, prompt caching works best when the request is designed as a stable prefix followed by a dynamic suffix. OpenAI documents both implicit and explicit breakpoints for GPT-5.6 and later models, including Astra. The practical distinction is control: implicit mode lets the platform look for cacheable prefixes automatically once the visible prefix is large enough, while explicit-only planning means your application deliberately marks the exact boundaries that should be eligible for reuse. Use implicit behavior for simple applications with naturally stable prompts; use explicit breakpoints when long context, tool schemas, tenant documents, or conversation history make accidental cache churn expensive.

The minimum cacheable visible prefix is 1,024 tokens. A breakpoint below that size will not create useful economics because there is not enough prefix to cache under OpenAI’s documented minimum. In long-context Astra workloads, the more important design rule is not “mark everything”; it is “mark only the boundaries that are stable enough to be reused inside the 30-minute TTL.” A breakpoint immediately after a unique user request, a timestamp, a randomized trace ID, or a one-off retrieved passage usually creates write cost without a corresponding read opportunity.

Implicit mode versus explicit-only breakpoint design

In implicit mode, the platform can identify reusable prefixes without you annotating every boundary. This is convenient for straightforward chat applications where the developer instructions, tool definitions, and early conversation turns are mostly identical between adjacent requests. The downside is observability and control: if your request assembly puts volatile content near the front, an implicit candidate may be different from turn to turn, and the cache hit rate will fall even though the request “looks similar” to a human operator.

Explicit-only design treats cacheability as part of the application contract. You place prompt_cache_breakpoint only after stable blocks, and you keep volatile user instructions, current task data, one-time retrieval results, and response-format tweaks after the final reusable boundary. This is especially important for Astra because the model supports a very large context window; a single request can contain developer policy, tool definitions, project files, retrieved documents, and a long running conversation. The bigger the prompt, the more damaging it is to put unstable content before a candidate boundary.

Mode Best fit Operational warning
Implicit caching Small or medium prompts where the prefix is naturally stable and request construction is simple. Do not assume similarity guarantees a hit; a changed early token can prevent reuse of the affected prefix.
Explicit breakpoint design Long-context workflows with stable policies, stable tool schemas, repeated documents, or append-only conversations. Breakpoints should be sparse and deliberate; OpenAI documents a four-write limit and considers only the latest 50 breakpoints.
Explicit-only operating pattern Cost-sensitive workloads where you want the application, not prompt layout accidents, to decide cache boundaries. Requires disciplined prompt assembly: stable prefix first, dynamic suffix last, and no timestamps or per-request IDs before reusable boundaries.

Where to place prompt_cache_breakpoint

Place prompt_cache_breakpoint on the item that ends a reusable block. The breakpoint should come after the stable content, not before it. A common pattern is one breakpoint after developer instructions, another after stable tool or workflow instructions, and another after a tenant-specific document pack that is reused across multiple requests. The current user’s task should normally remain after the last breakpoint so it does not become part of the cache key material for future requests.

Do not place a breakpoint inside content that changes per request. Examples of bad breakpoint placement include a developer message that includes the current time, a “session metadata” block that changes on every API call, or a retrieved document list sorted by transient score. If those items must be available to the model, put them after the reusable prefix or isolate them in a later block that you do not expect to cache.

{
  "model": "gpt-6-astra",
  "prompt_cache_key": "tenant-acme:policy-pack-v7",
  "prompt_cache_options": {
    "ttl": "30m"
  },
  "input": [
    {
      "role": "developer",
      "content": [
        {
          "type": "input_text",
          "text": "You are the enterprise support analyst for Acme. Follow the escalation policy, cite policy section IDs, and ask a clarifying question only when the missing fact would change the answer."
        }
      ],
      "prompt_cache_breakpoint": true
    },
    {
      "role": "user",
      "content": [
        {
          "type": "input_text",
          "text": "Stable policy pack v7:\nSection A: Account recovery rules...\nSection B: Data export rules...\nSection C: Escalation rules..."
        }
      ],
      "prompt_cache_breakpoint": true
    },
    {
      "role": "user",
      "content": [
        {
          "type": "input_text",
          "text": "Current ticket: The customer is locked out after changing devices. Region: Canada. Plan: Business. What should the agent do next?"
        }
      ]
    }
  ]
}

This example is intentionally structured with the dynamic ticket last. The developer instructions and policy pack are likely to be reused for multiple support tickets inside the 30-minute TTL, so they are reasonable cache candidates. The current ticket is not marked because it is specific to one answer. If the next request uses the same developer instructions and the same policy pack under a compatible cache key, the application has given the platform a stable prefix to reuse.

The four-write limit and the latest 50 considered breakpoints

OpenAI documents two limits that should shape request design: there is a four-write limit, and only the latest 50 breakpoints are considered. The four-write limit means a single request should not attempt to establish a cache entry at every possible boundary. Treat four as a hard budget for meaningful layers, not as a target you must always fill. If your prompt has 20 sections, choose the sections that are reused together most often and are large enough to matter.

The “latest 50 considered breakpoints” rule matters most in append-only conversations and agent traces. If your application adds a breakpoint to every user message, assistant message, tool result, and observation, older useful breakpoints can fall out of the latest-50 set. That creates a counterintuitive failure mode: the conversation becomes longer, but the stable boundary you wanted to reuse is no longer one of the considered candidates. The fix is to place breakpoints at coarse semantic boundaries, such as “developer contract,” “tool schema pack,” “project file snapshot,” and “conversation summary through turn 40,” rather than at every turn.

For Long Context Prompt Design, Wall of Context Prompting: The 2026 Technique That Is Replacing Long ChatGPT Prompts is the most relevant adjacent resource. The Wall of Context technique shows how to structure substantial reference material for model consumption, making it a useful companion to the stable-prefix and dynamic-suffix patterns in this cache guide.

Keep developer instructions stable and move dynamic suffixes later

Developer instructions are usually the highest-value cache prefix because they appear in every request for an application. They should define role, constraints, output contract, citation rules, escalation behavior, and safety-relevant operating boundaries. They should not include per-request values such as the user’s name, the current date, the active experiment bucket, or a request ID. If those values affect the answer, put them in a later user message or metadata block after the reusable developer prefix.

Stable does not mean generic. A strong developer message can still be specific: it can require JSON output, define refusal handling, specify when Astra should ask clarifying questions, and describe how to use tools. The important point is that the bytes should remain identical across requests that are intended to share a cache entry. Even minor formatting changes, reordered bullet lists, or regenerated policy prose can split cache locality.

from openai import OpenAI
import hashlib

client = OpenAI()

def make_prompt_cache_key(tenant_id: str, policy_version: str) -> str:
    raw = f"{tenant_id}:{policy_version}".encode("utf-8")
    digest = hashlib.sha256(raw).hexdigest()[:16]
    return f"tenant:{tenant_id}:policy:{digest}"

response = client.responses.create(
    model="gpt-6-astra",
    prompt_cache_key=make_prompt_cache_key("acme", "policy-pack-v7"),
    prompt_cache_options={"ttl": "30m"},
    input=[
        {
            "role": "developer",
            "content": [
                {
                    "type": "input_text",
                    "text": (
                        "You are the enterprise support analyst for Acme. "
                        "Use the policy pack when applicable, cite section IDs, "
                        "and return concise next-step guidance for a human agent."
                    )
                }
            ],
            "prompt_cache_breakpoint": True
        },
        {
            "role": "user",
            "content": [
                {
                    "type": "input_text",
                    "text": (
                        "Stable policy pack v7:\n"
                        "Section A: Account recovery rules...\n"
                        "Section B: Data export rules...\n"
                        "Section C: Escalation rules..."
                    )
                }
            ],
            "prompt_cache_breakpoint": True
        },
        {
            "role": "user",
            "content": [
                {
                    "type": "input_text",
                    "text": (
                        "Dynamic ticket for this request:\n"
                        "Customer is locked out after changing devices. "
                        "Region: Canada. Plan: Business."
                    )
                }
            ]
        }
    ]
)

print(response.id)

The Python example uses a deterministic cache key derived from tenant and policy version. That is a routing aid, not a guarantee of a hit. OpenAI’s prompt caching guidance describes cache keys as a way to improve the probability of reaching infrastructure with a matching cache; applications should still measure actual cached-input usage from responses and billing data rather than assuming every compatible request is a read.

Append-only conversation history without cache churn

Append-only history is cache-friendly because previous turns remain byte-stable as new turns are added. The dangerous pattern is rebuilding old turns on every request: rewriting summaries, normalizing old messages, inserting new annotations before earlier content, or reserializing tool results in a different order. If a conversation prefix changes, the model may receive semantically equivalent context, but the cache will not see the same prefix.

For long conversations, use periodic stable summaries as cache layers. For example, after turn 30, create a summary message that becomes part of the stable prefix for subsequent turns, mark a breakpoint after it, and then append new turns after that point. Do not revise that summary on every request. When the summary must change, treat it as a new version and expect a write before reads resume. This makes cost behavior predictable: summary version N is reused until the application deliberately creates summary version N+1.

A practical breakpoint layout for an agent conversation is: stable developer instructions, stable tool instructions, stable project or tenant context, stable conversation summary, then the latest unsummarized turns. The latest user message and any fresh retrieval results should be in the dynamic suffix. If the model asks clarifying questions, preserve the prior messages exactly and append the answer; do not splice the answer into an earlier prompt block.

Tool definitions, allowed_tools, and cache-compatible controls

Tool configuration can be a large part of the visible prompt, so it deserves the same stability discipline as text instructions. Keep tool names, descriptions, and JSON schemas stable when you want them cached. Reordering tools, changing descriptions, or injecting per-request constraints into tool schemas can break reuse. If a tool is only needed for a subset of tasks, consider deferred tool loading rather than placing a large, rarely used schema pack before a breakpoint on every request.

When the full tool set is stable but the current turn should only use a subset, use compatible tool controls such as allowed_tools rather than mutating the tool definitions themselves. This preserves the stable tool schema prefix while still constraining the model’s available actions for the turn. The exact control strategy should match your safety and product requirements: a support bot might allow only policy lookup for ordinary questions and add ticket creation only after the user confirms the action.

{
  "model": "gpt-6-astra",
  "prompt_cache_key": "tenant-acme:support-tools-v3",
  "prompt_cache_options": {
    "ttl": "30m"
  },
  "tools": [
    {
      "type": "function",
      "name": "lookup_policy",
      "description": "Search the approved support policy pack by query.",
      "parameters": {
        "type": "object",
        "properties": {
          "query": {
            "type": "string"
          }
        },
        "required": ["query"],
        "additionalProperties": false
      }
    },
    {
      "type": "function",
      "name": "open_ticket",
      "description": "Create an internal escalation ticket after the user confirms escalation.",
      "parameters": {
        "type": "object",
        "properties": {
          "summary": {
            "type": "string"
          },
          "priority": {
            "type": "string",
            "enum": ["low", "normal", "high"]
          }
        },
        "required": ["summary", "priority"],
        "additionalProperties": false
      }
    }
  ],
  "tool_choice": {
    "type": "allowed_tools",
    "mode": "auto",
    "tools": [
      {
        "type": "function",
        "name": "lookup_policy"
      }
    ]
  },
  "input": [
    {
      "role": "developer",
      "content": [
        {
          "type": "input_text",
          "text": "Use approved support tools only. Do not create escalation tickets unless the user has confirmed escalation."
        }
      ],
      "prompt_cache_breakpoint": true
    },
    {
      "role": "user",
      "content": [
        {
          "type": "input_text",
          "text": "Can this customer export account data after losing access to their old phone?"
        }
      ]
    }
  ]
}

This JSON keeps the tool definitions stable and narrows the allowed tool set for the current turn. The operational goal is to avoid changing the expensive prefix merely to enforce a per-turn policy. If a later turn requires ticket creation, the application can allow the additional tool without rewriting the tool schema text. As with all cache design, verify behavior in your telemetry: stable structure improves the probability of reuse, but it does not replace measurement.

Breakpoint checklist for Astra long-context requests

  • Mark stable endings, not stable beginnings. Put prompt_cache_breakpoint after the reusable developer instructions, document pack, tool instructions, or durable summary.
  • Respect the 1,024-token minimum. Very short prefixes may be structurally clean but economically irrelevant because they do not meet OpenAI’s minimum cacheable visible prefix.
  • Budget for four writes. Design no more than four meaningful write candidates per request; more fine-grained boundaries usually add complexity without improving reuse.
  • Remember the latest-50 rule. Avoid adding breakpoints to every conversation turn because older useful boundaries can stop being considered.
  • Keep dynamic suffixes last. Current user tasks, fresh retrievals, timestamps, request IDs, experiment labels, and one-off formatting overrides belong after the reusable prefix.
  • Keep tools stable. Prefer stable tool schemas plus compatible controls such as allowed_tools; avoid regenerating descriptions or reordering tool definitions per request.
  • Version deliberately. When a policy pack, summary, or tool schema changes, update the cache key and expect an initial write before reads resume.

Operational warning: prompt caching is not a substitute for prompt determinism. If your application rebuilds the same logical prompt with different ordering, whitespace, injected metadata, or regenerated summaries, Astra may still answer well, but the cache may not see a reusable prefix.

Routing cacheable Astra traffic without over-sharding

GPT-6 Astra Prompt Caching Guide: Explicit Breakpoints, Cache Keys, 30-Minute TTL, and Long-Context Cost Control — workflow, safety, and decision visual

For GPT-6 Astra, prompt_cache_key should be treated as a cache-affinity routing hint, not as the cache itself. OpenAI documents deterministic prompt_cache_key sharding as an optimization method: requests with the same stable prefix should use the same key so they are more likely to reach infrastructure that has already seen the prefix. The key does not make a non-identical prefix reusable, does not override TTL expiration, and does not guarantee a hit when capacity, routing, or regional placement prevents reuse.

A practical key should group requests by the content that actually appears before the cache breakpoint. If two requests share the same system/developer instructions, tool schemas, selected files, policy block, and long reference corpus, they are candidates for the same key. If one request uses a different tool schema version or a different knowledge-base snapshot, it should normally use a different key because the visible prefix is no longer the same. Overly broad keys waste routing affinity by sending unrelated prefixes to the same shard; overly narrow keys destroy reuse by making every conversation look unique.

Recommended deterministic key ingredients

Key ingredient Include when Do not include when Operational reason
Application or product area Different products have different long instructions or tools. All products share the exact same prefix and breakpoint layout. Separates prefixes that are unlikely to match while keeping high-volume workflows grouped.
Tenant or customer partition Tenant-specific policy, documents, tools, or data residency rules appear in the prefix. The prefix is genuinely global and contains no tenant-specific material. Prevents incompatible prefixes from competing for the same affinity group.
Prompt template version Developer instructions, ordering, or cache breakpoints change. Only the dynamic user suffix changes after the breakpoint. A single changed sentence before the breakpoint invalidates the prefix match.
Tool schema version Tool definitions appear before the breakpoint. Tools are deferred or loaded after the cached prefix. Tool schema edits are a common hidden cause of cache misses.
Reference corpus or file bundle version Large reusable documents are placed in the prefix. The file selection is per-request and not reused. Groups requests around the expensive long-context payload that actually drives savings.
Region or data-residency partition Your deployment can route the same workflow to more than one region or residency boundary. All traffic for the workflow is pinned to one documented residency path. A warmed cache in one regional routing domain should not be assumed available in another.

Recommendation: generate the key from canonical metadata, not from raw prompt text or user-provided content. A key such as contracts:v12|tools:v4|kb:2026-09-03|tenant:acme|region:eu is easier to reason about than a full prompt hash pasted into logs. If your logs are widely accessible, avoid embedding raw personal data, document titles, or customer secrets in the key; the key is an operational routing value, not a privacy boundary.

// Example: deterministic prompt-cache key construction.
// Adapt field names and request construction to your SDK and governance rules.

const cacheKeyParts = {
  app: "contract-review",
  promptTemplate: "v12",
  toolSchema: "v4",
  corpus: "kb-2026-09-03",
  tenantPartition: "tenant-acme",
  residency: "eu"
};

const promptCacheKey = [
  cacheKeyParts.app,
  cacheKeyParts.promptTemplate,
  cacheKeyParts.toolSchema,
  cacheKeyParts.corpus,
  cacheKeyParts.tenantPartition,
  cacheKeyParts.residency
].join("|");

// Use the same key only when the prefix before your cache breakpoint is stable.
const requestOptions = {
  model: "gpt-6-astra",
  prompt_cache_key: promptCacheKey,
  prompt_cache_options: { ttl: "30m" }
};

Cache routing limits that affect production hit rates

The first routing limit is exact-prefix compatibility. A stable prompt_cache_key can improve the probability that a request reaches a machine with a matching prefix, but the prefix still has to match the cacheable content and breakpoint rules. Reordering tool definitions, inserting a timestamp before the breakpoint, changing an instruction banner, or including a per-user nonce in the prefix can turn a seemingly identical request into a fresh cache write.

The second routing limit is regional separation. If your architecture sends the same Astra workload through different data-residency or regional routing paths, plan as though each path has its own warm-up curve. Do not warm a cache in one residency configuration and then assume an immediate hit after failover to another. OpenAI’s Astra migration documentation also notes that Fast mode is unavailable for Astra with EU data residency, so routing, residency, and pricing-mode decisions should be evaluated together rather than treated as independent toggles.

The third routing limit is key cardinality. A key per end-user conversation usually performs poorly unless the same conversation sends repeated requests within the TTL and keeps appending after the cached prefix. A key per high-volume workflow usually performs better because many users can reuse the same long instructions, tool schemas, and reference bundle. For multi-tenant SaaS, the decision rule is simple: shard by tenant only when tenant-specific material appears before the breakpoint or when your compliance model requires separation; otherwise, consider grouping by workflow and version to increase reuse density.

The fourth routing limit is time. OpenAI documents prompt_cache_options.ttl with "30m" for GPT-5.6 and later prompt caching. Treat this as an idle retention window for planning: if a cached prefix is not reused within the retention period, later traffic should be budgeted as a new write rather than a read. When a prefix is reused successfully, the reuse can refresh the cache’s useful life, so high-frequency workloads can stay warm while sporadic long-context jobs repeatedly pay the write premium.

Operational warning: a cache hit is an optimization outcome, not a contract. Build dashboards that compare expected cacheable tokens with actual cached-input billing, and investigate regressions after prompt-template deploys, tool-schema changes, corpus refreshes, regional failover, or traffic drops below the 30-minute reuse cadence.

How the 30-minute TTL changes batching and scheduling

The 30-minute TTL rewards burst planning. If a support automation system needs to process 400 tickets against the same 180,000-token policy and product-manual prefix, the cheapest pattern is usually to send the first request to write the prefix and then keep subsequent related requests flowing before the cache cools. If the same 400 tickets are spread evenly across a day with long idle gaps, the system may pay multiple cache-write charges for the same prefix.

Proposed workflow: group jobs by prompt_cache_key, then schedule each group in a short window when latency and queue constraints allow. This does not require putting all user-specific content in the prefix. Keep the reusable corpus, instructions, and tools before the breakpoint, and place the ticket text, user question, or transaction-specific evidence after it. The scheduling goal is to maximize prefix reuse while keeping each request’s dynamic suffix correct and auditable.

For interactive applications, append-only conversation structure is still important. If the stable prefix contains your developer instructions, selected tool definitions, and a large customer knowledge pack, later user turns should be appended after that prefix rather than inserted into it. Mid-conversation configuration changes should be handled in a cache-safe way where supported; OpenAI’s Astra migration guidance notes that configuration_update items can change reasoning effort during a conversation while preserving the prompt prefix for caching.

For Model Routing Cost Optimization, How to Run a Two-Tier Model Routing Stack (Sentinel + Executor) for 90% Cost Cut is the most relevant adjacent resource. The two-tier Sentinel-and-Executor routing architecture shows how lower-cost models and premium executors can be combined, extending this guide’s cache economics into workload-level model selection.

Pricing threshold: above 272,000 input tokens changes the full request

OpenAI’s current pricing table for GPT-6 Astra distinguishes standard short-context pricing from requests above 272,000 input tokens. At or below the short-context band, Standard pricing is $10 per million input tokens, $12.50 per million cache-write tokens, $1 per million cached-input tokens, and $50 per million output tokens. For requests above 272,000 input tokens, the full request is billed at $20 per million input tokens, $25 per million cache-write tokens, $2 per million cached-input tokens, and $75 per million output tokens.

The phrase “for the full request” is the cost-control trap. If your request crosses 272,000 input tokens, do not model only the tokens above 272,000 at the higher price. The whole request moves to the long-context rate table. A 260,000-token reusable prefix plus a 20,000-token dynamic suffix is not “mostly short context” for pricing purposes; it is a request above 272,000 input tokens, so the applicable Astra long-context input, cached-input, and cache-write rates apply to the request.

Decision rule: when total input is close to 272,000 tokens, optimize the boundary before optimizing the cache key. Removing or deferring 10,000 low-value tokens can keep an entire request in the short-context pricing band. Conversely, if the task genuinely needs a 500,000-token evidence pack, accept the long-context rate and focus on making the expensive prefix reusable across as many requests as possible within the TTL.

Labeled cost model for cache writes and reuses

Calculation assumptions: the following tables isolate the reusable prefix only, use 1,000,000 cacheable input tokens as the unit, assume one initial cache write followed by the stated number of successful cached reuses, exclude output tokens, exclude non-cacheable dynamic suffix tokens, exclude Batch/Flex/Fast modifiers, and assume Standard GPT-6 Astra pricing from OpenAI’s current pricing table. The baseline is the same number of requests with no caching benefit, billed as ordinary input each time.

For AI API Token Cost Calculator, What AI Coding Tools Really Cost in 2026: Complete Guide to Hidden Expenses, Token Budgets, and ROI Calculation for Engineering Teams is the most relevant adjacent resource. The engineering-cost guide demonstrates how token budgets, developer review time, and hidden operational expenses combine, helping readers turn cache-hit data into a realistic cost model.

Short-context Standard calculation Formula per 1M reusable prefix tokens Total with caching Uncached baseline Modeled savings
1 reuse after initial write $12.50 write + 1 × $1 read $13.50 2 × $10 = $20.00 $6.50, or 32.5%
2 reuses after initial write $12.50 write + 2 × $1 read $14.50 3 × $10 = $30.00 $15.50, or 51.7%
5 reuses after initial write $12.50 write + 5 × $1 read $17.50 6 × $10 = $60.00 $42.50, or 70.8%
10 reuses after initial write $12.50 write + 10 × $1 read $22.50 11 × $10 = $110.00 $87.50, or 79.5%

Short-context interpretation: the first request is more expensive than ordinary uncached input because cache writes cost $12.50 per million tokens instead of $10 per million input tokens. The first successful reuse more than compensates for that premium in this simplified model. With no reuse, caching is a cost increase; with repeated reuse, the average cost per request falls quickly because cached reads are billed at $1 per million tokens.

Long-context Standard calculation Formula per 1M reusable prefix tokens Total with caching Uncached baseline Modeled savings
1 reuse after initial write $25 write + 1 × $2 read $27.00 2 × $20 = $40.00 $13.00, or 32.5%
2 reuses after initial write $25 write + 2 × $2 read $29.00 3 × $20 = $60.00 $31.00, or 51.7%
5 reuses after initial write $25 write + 5 × $2 read $35.00 6 × $20 = $120.00 $85.00, or 70.8%
10 reuses after initial write $25 write + 10 × $2 read $45.00 11 × $20 = $220.00 $175.00, or 79.5%

Long-context interpretation: the percentage savings mirror the short-context case because OpenAI’s published Astra long-context cache-write and cached-input rates preserve the same 1.25× write and 0.1× read relationship to ordinary input. The dollar impact is larger because every million input tokens costs twice as much in the long-context band, and output tokens also move from $50 to $75 per million tokens when the request is above 272,000 input tokens.

Applying the math to a near-threshold request

Example calculation: suppose a request has a 250,000-token reusable prefix and a 15,000-token dynamic suffix, for 265,000 input tokens before output. Under the stated assumptions, it remains in short-context pricing. The prefix write costs 0.25 × $12.50 = $3.125, and each cached reuse of that prefix costs 0.25 × $1 = $0.25. The dynamic suffix is still ordinary input on every request, so it costs 0.015 × $10 = $0.15 per request before output.

Threshold-crossing variant: if the dynamic suffix grows to 30,000 tokens, total input becomes 280,000 tokens and the full request moves to long-context pricing. The same 250,000-token prefix write becomes 0.25 × $25 = $6.25, each cached prefix read becomes 0.25 × $2 = $0.50, and the 30,000-token dynamic suffix costs 0.03 × $20 = $0.60 per request before output. The extra 15,000 suffix tokens therefore do more than add their own tokens; they move the entire request into the higher rate table.

The operational lesson is to manage the 272,000-token boundary as a routing and prompt-design constraint. If a workflow sometimes needs 240,000 tokens and sometimes needs 500,000, it may deserve two routes: a short-context route that aggressively trims or defers marginal context, and a long-context route that intentionally loads the full evidence pack and relies on cache reuse. Using one average estimate for both paths can hide the moments when a small suffix increase doubles the applicable input and cache-write rates.

Operating Astra prompt caches after launch

Production prompt caching should be treated as an observability and release-management problem, not just a request-serialization trick. OpenAI documents prompt caching for GPT-5.6 and later models with cache writes, cached reads, explicit and implicit breakpoints, a 1,024-token minimum visible prefix, and prompt_cache_options.ttl: "30m". For GPT-6 Astra, the operational goal is to make the expensive, stable prefix repeat often enough within that 30-minute window that cached reads offset the higher cache-write charge and the risk of long-context requests crossing the 272,000-token pricing threshold.

Monitor cache hits as a first-class production metric

For AI Observability Dashboard, How to Embed Codex in an Internal Operations Dashboard with App-Server, MCP Tools, Streaming, and Human Approvals is the most relevant adjacent resource. The Codex operations-dashboard tutorial shows how streaming events, tool activity, and approvals can be surfaced for operators, offering a practical design reference for cache-hit and latency observability.

{
  "event": "astra_prompt_cache_observation",
  "model": "gpt-6-astra",
  "prompt_cache_key_hash": "sha256:6b2e...",
  "cache_ttl": "30m",
  "prefix_version": "legal-review-v17",
  "tool_schema_version": "tools-v42",
  "reasoning_effort": "medium",
  "input_tokens": 186240,
  "cached_input_tokens": 174912,
  "breakpoints_sent": 3,
  "tenant_shard": "tenant_hash:91af",
  "long_context_pricing_band": false
}

The example log deliberately hashes routing and tenant identifiers because cache observability often moves through analytics systems with broader access than the application runtime. The exact token-usage field names can vary by SDK and API abstraction, so normalize the usage object at your edge and store both raw usage metadata and a stable internal schema. If cached-token metadata is absent for a given client path, record that absence explicitly rather than treating it as a zero-hit request.

Diagnose misses by comparing the prefix, not the whole prompt

Most cache misses come from unintentional prefix changes. When a request misses, compare the bytes or canonicalized objects before the first cache breakpoint, not the dynamic user message at the end. Common culprits include regenerated system instructions, reordered JSON keys in tool schemas, build timestamps embedded near the top of the prompt, appended policy snippets inserted before stable documents, randomized example IDs, and environment-specific banners such as “staging” or “production” placed inside the cacheable prefix.

Miss pattern Operational cause Recommended fix
High writes after every deploy Developer prompt, skills text, or tool JSON changes with each build Version stable prefix content explicitly and move build metadata after the final breakpoint
Hits for one tenant but misses for another Tenant-specific instructions are placed before shared corpus content Put shared instructions and shared documents first, then tenant-specific suffixes, while preserving isolation requirements
Hits disappear when tools are enabled Tool definitions are loaded in a different order or with generated descriptions Canonicalize tool schemas and use stable tool bundles with append-only versioning
Misses on “same” conversation History compaction rewrites earlier turns before a breakpoint Append compacted summaries after a new version marker or avoid compacting the cached prefix
Misses after reasoning escalation Reasoning settings changed in the initial request instead of later steering/configuration flow Keep initial cacheable prefix stable; use documented configuration_update behavior when changing reasoning during a conversation

Control tool-schema drift before it becomes a cost leak

Astra supports a broad set of Responses API tools, and tool definitions are often large enough to dominate the cacheable prefix. Treat every tool definition as production API surface: sort keys deterministically, avoid generated prose that changes between deployments, pin schema versions, and keep deprecated fields in place until a planned prefix-version cutover. If your application uses allowed_tools or deferred tool loading, keep the base tool catalog stable and vary the allowed subset later in the request when possible.

A useful release rule is: any change that alters tool names, JSON schemas, descriptions, authentication assumptions, or safety instructions should increment a tool_schema_version and trigger a cache-impact review. Small text edits can have large cost effects when they occur before the first explicit breakpoint. For high-volume agents, run a prefix-diff test in CI that serializes the full request up to each breakpoint and fails the build if an unapproved change appears.

# Recommended CI check: compare canonical prefix snapshots
serialize_request_prefix(request, breakpoint_index=1) > prefix.bp1.json
serialize_request_prefix(request, breakpoint_index=2) > prefix.bp2.json

# Fail unless the prefix-version manifest acknowledges the diff.
diff --unified approved/prefix.bp1.json prefix.bp1.json
diff --unified approved/prefix.bp2.json prefix.bp2.json

Handle reasoning changes without invalidating the stable prefix

OpenAI’s Astra guidance documents reasoning efforts low, medium, high, xhigh, and max, and it notes that configuration_update items can change reasoning effort during a conversation while preserving the prompt prefix for caching. The operational implication is simple: choose a default reasoning effort for the initial request shape and avoid rebuilding the front of the prompt when a later step needs more or less reasoning. Sending unsupported values such as none is not a cache issue; OpenAI documents that Astra does not support none reasoning and returns an error for it.

For complex workflows, separate “cacheable context loading” from “reasoning escalation.” For example, a legal-review application can load the stable playbook, matter taxonomy, tool schemas, and document bundle behind explicit breakpoints using a default effort, then escalate reasoning only when the model reaches a hard classification or drafting decision. This preserves the expensive prefix and avoids making every exploratory request pay for a new cache write.

Compact long conversations without rewriting cacheable history

Conversation compaction is necessary in long-running Astra sessions because even a 1,050,000-token context window can be consumed by tool traces, retrieved files, and iterative drafts. The cache risk is that many compaction systems rewrite older turns near the top of the conversation, which changes the visible prefix and destroys reuse. Prefer append-only compaction: keep the original cached prefix intact, add a dated summary after a new breakpoint or later suffix, and mark which source turns the summary supersedes for the application’s own retrieval logic.

Do not insert fresh summaries, “current status,” or “latest plan” blocks before stable policies and schemas. If the model needs a compact state early for quality reasons, make that block an explicit versioned artifact and accept that changing it creates a new cache lineage. This is a product decision: a frequently updated state summary can improve task quality, but it should not be mistaken for a reusable static prefix.

Keep timestamps, run IDs, and deployment metadata out of the prefix

Timestamps are a common invisible cache killer. A prompt that starts with “Current time: 2026-09-04T10:31:07Z” creates a different prefix on nearly every request, even if the rest of the context is identical. Place volatile time, request IDs, trace IDs, experiment names, user locale, and per-run deadlines after the last breakpoint unless the model truly needs that data to interpret earlier instructions. When time is required in the prefix, round it to the coarsest useful unit and include it in the prefix-version plan rather than allowing per-second churn.

Shard cache keys for tenant isolation and routing efficiency

OpenAI documents prompt_cache_key as a way to route requests toward machines more likely to have a matching cache, but routing keys do not guarantee hits. For multi-tenant systems, choose deterministic keys that balance reuse and isolation. A common pattern is to include environment, application, model family, stable prefix version, tool-schema version, and a tenant or tenant-group hash when tenant-specific data appears in the cacheable prefix. Avoid raw customer names, emails, project titles, or secrets in the key because keys often appear in logs and support traces.

Do not rely on cache keys as an authorization boundary. Your application must still enforce tenant access before constructing the request, before loading files, and before enabling tools. The key’s job is routing and cache locality, not permissioning. If two tenants share exactly the same public policy corpus and tool schema, a shared prefix version may be operationally reasonable; if the prefix contains tenant contracts, private files, custom instructions, or regulated data, isolate the cache lineage with a tenant-specific shard and separate observability views.

Review zero-data-retention and regulated-workload requirements

Zero-data-retention and regulated deployments require a separate policy check before enabling any cache-dependent architecture. The 30-minute cache TTL is an API caching control described for prompt caching; it should not be treated as a complete statement of contractual retention, eligibility, residency, audit, or compliance behavior for your account. Before rollout, confirm in OpenAI’s current documentation and your enterprise agreement whether prompt caching is available for the workload, how it interacts with your data-retention commitments, and whether any internal policy prohibits caching particular categories of content.

For sensitive systems, implement a classification gate before breakpoint placement. Public templates, product documentation, and non-sensitive tool schemas can usually be evaluated for shared prefix caching. Customer secrets, privileged legal material, patient data, financial account details, and security findings may require tenant-specific keys, shorter workflows, redaction, or no caching depending on your obligations. The engineering team should not decide this alone; involve security, legal, and the data owner before cached prefixes become a default platform behavior.

Run rollout experiments that isolate cache effects

A valid cache experiment compares equivalent task traffic with controlled prompt versions. Create at least two cohorts: a baseline that uses the current request layout and a candidate that uses explicit breakpoints, stable serialization, deterministic cache keys, and timestamp relocation. Measure cached-token ratio, cache-write volume, total input cost, output cost, latency if your telemetry captures it, model errors, incomplete responses, and task-quality review results. Keep the model, reasoning effort, tool availability, and user population as constant as possible so that cache effects are not confused with model-selection or product changes.

Run the experiment long enough to include repeated requests within the 30-minute TTL, but do not average away cold-start behavior. Report first-request cost, second-request cost, and steady reuse separately because cache writes are more expensive than ordinary uncached input under OpenAI’s GPT-5.6-and-later cache pricing model, while cached reads are cheaper. A cache plan that looks excellent on the fifth reuse may still be uneconomic for one-off requests or sporadic tenants whose traffic rarely returns within the TTL.

Operational checklist for GPT-6 Astra prompt caching

  • Define cacheable prefixes: Identify the stable instructions, tool definitions, skills, documents, and examples that exceed the 1,024-token minimum and are likely to repeat within 30 minutes.
  • Place explicit breakpoints deliberately: Put breakpoints after large stable blocks, not after volatile metadata, and remember the documented constraints around considered breakpoints and write behavior.
  • Canonicalize serialization: Use deterministic JSON ordering, stable whitespace rules, pinned schema versions, and CI prefix snapshots for developer prompts and tool definitions.
  • Separate volatile suffixes: Move timestamps, trace IDs, user-specific questions, run IDs, and experiment labels after the final cacheable breakpoint unless they are essential earlier.
  • Version tool bundles: Track tool_schema_version, review every tool-description change, and avoid accidental drift from generated descriptions or reordered schemas.
  • Plan reasoning transitions: Use supported Astra reasoning efforts and prefer documented configuration_update changes during a conversation when escalation is needed without rebuilding the prefix.
  • Design tenant-aware keys: Include stable version and tenant-shard ingredients where appropriate, hash sensitive identifiers, and never treat routing keys as access control.
  • Check regulated-data rules: Validate zero-data-retention, residency, and enterprise-contract requirements before caching sensitive prefixes or enabling shared cache lineages.
  • Instrument hit quality: Log cached tokens, writes, misses, long-context threshold crossings, prefix versions, tool versions, and SDK usage metadata availability.
  • Experiment before global rollout: Compare baseline and candidate layouts on cost, reuse, quality, incomplete responses, and operational errors before making caching mandatory.

The durable lesson for Astra operations is that prompt caching rewards boring engineering discipline: stable prefixes, deterministic schemas, append-only history, tenant-aware routing, and measured rollouts. OpenAI’s documented 30-minute TTL, cache-write/read pricing, explicit breakpoints, and Astra-specific reasoning controls give teams enough levers to control long-context cost, but those levers only work when the application stops treating prompts as ad hoc strings and starts managing them as versioned production artifacts.

Access 40,000+ AI Prompts for ChatGPT, Claude & Codex — Free!

Subscribe to get instant access to our complete Notion Prompt Library — the largest curated collection of prompts for ChatGPT, Claude, OpenAI Codex, and other leading AI models. Optimized for real-world workflows across coding, research, content creation, and business.

Get Free Access Now →

Useful Links

Get Free Access to 40,000+ AI Prompts for ChatGPT, Claude & Codex

Subscribe for instant access to the largest curated Notion Prompt Library for AI workflows.

More on this