A developer who has used Anthropic's Messages API is used to marking a `cache_control` breakpoint on the content she wants cached (such as a large system prompt or reference document), so that stable content is reused across calls and only new content is billed at full price. Moving the same workload to OpenAI's API, she wants to know whether she must add an equivalent manual marker to get a caching discount. Per OpenAI's own documentation on prompt caching, what should she expect?
- No manual marker is required for basic caching: OpenAI's prompt caching is applied automatically, matching and reusing the longest previously-seen prefix of a prompt once the prompt is long enough to qualify, without any `cache_control`-style parameter needed to opt in
- Yes, the requirement is identical: she must annotate the exact same content block with a `cache_control` field, using the same syntax as Anthropic's API, or no caching discount will ever apply
- No, because OpenAI's API does not offer any form of prompt caching at all, regardless of prompt length or repetition
- Yes, but only through a separate paid add-on subscription that must be purchased before any caching discount becomes available on cached tokens
Why A? And why not the others?
Correct answer: A. No manual marker is required for basic caching: OpenAI's prompt caching is applied automatically, matching and reusing the longest previously-seen prefix of a prompt once the prompt is long enough to qualify, without any `cache_control`-style parameter needed to opt in
OpenAI's documentation describes prompt caching as automatic: once a prompt reaches a minimum length, the API caches the longest prefix of the prompt it has already computed and reuses that cached prefix on subsequent requests that share the same beginning, applying a discount without the caller needing to add any special annotation to opt in. This is a meaningfully different design from Anthropic's Messages API, where the caller must explicitly mark a `cache_control` breakpoint on the content it wants cached; OpenAI's basic caching happens purely as a side effect of repeated prefixes, not an explicit instruction. The option claiming an identical `cache_control`-style requirement is wrong because OpenAI's basic caching mechanism needs no such field and does not share Anthropic's syntax. The option claiming OpenAI offers no prompt caching at all is wrong because automatic prefix-based caching is a documented, real feature of OpenAI's API. The option describing a separate paid add-on subscription is wrong because the caching discount OpenAI describes applies automatically to qualifying requests as part of normal API usage, not as a separately purchased product.
Source: OpenAI, 'Prompt Caching in the API' (openai.com/index/api-prompt-caching/); Anthropic, Claude Platform Docs on prompt caching (contrasting explicit cache_control breakpoints)