passdrill
AI & LLM Engineering · Prompt Engineering · Card 032/039 easy

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?

  1. 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
  2. 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
  3. No, because OpenAI's API does not offer any form of prompt caching at all, regardless of prompt length or repetition
  4. Yes, but only through a separate paid add-on subscription that must be purchased before any caching discount becomes available on cached tokens
Next card → Shuffle