How to Use OpenAI Prompt Caching to Reduce AI Content Automation Costs
Every draft your workflow requests from the API opens with the same material: the brand guide, the voice rules, the platform instructions and a few approved examples. OpenAI prompt caching lets the API reuse that unchanged opening instead of processing it again, and it bills the reused part at a fraction of the ordinary input rate. It only works when the stable part of the prompt comes first and arrives identical every time, so the saving is decided by how the content system is built, not by a single setting. This guide explains how caching works, what it costs, how to lay out a multi-client prompt for it, how to measure the result, and how we run it inside a Claude Code and n8n content system.
What a cached content prompt rests on
- How does prompt caching work in OpenAI's API?
- Cache hits, cache misses, and how long a cached prompt lives
- Prompt caching API pricing: what gets cheaper and what does not
- How to order a content prompt so the stable part caches
- Five clients, five prefixes: how an agency lays out caching
- How Paper Eagle AI runs prompt caching in Claude Code and n8n
- Measuring savings with OpenAI cached input tokens and cache writes
- What prompt caching does not do, and what stays with a person
- What caching saves a content workflow, and what it costs to set up
- Frequently asked questions
- Where to start
How does prompt caching work in OpenAI's API?
Prompt caching stores the work the model has already done on the start of a prompt, so a later request that begins with exactly the same tokens can skip that work. OpenAI's prompt caching guide says caching is enabled by default for supported models, and that reuse requires the entire rendered prefix to match. Change one character near the top and everything after it is processed again. What is kept is not your text but the model's computed state for it, which is why the match has to be exact. On GPT-5.6 and later the minimum cacheable prompt length is 1,024 tokens, so a two-line instruction never caches at all.
What happens when a request reaches the cache
Prefix matches the entire rendered prefix is the same
Stored work reused the computed state is not rebuilt
Character changed near the top of the prompt
Processed again everything after the change
The response, read after the part that changes
The prefix is everything the model reads before the part that changes, in the order it reads it. That includes tool definitions, developer instructions and reference material, which is exactly where a content workflow's brand guide and voice rules sit. Without any setting, the API places a breakpoint at the end of the latest eligible message, such as the last developer message in the opening group, and caches up to that point. You can switch to explicit mode with prompt_cache_options and mark your own breakpoints instead, and a single request can create up to four cache writes. Explicit breakpoints matter when a prompt has layers that change at different speeds, which a content prompt always does. Newer models moved one piece of this: from GPT-6.2 the top-level instructions field is appended after the input and never cached, so a brand guide kept there is billed in full every time, which our analysis of GPT-6.2 Astra and Sol for content workflows explains. For image generation the stable part is worth keeping too, and our Higgsfield AI prompt library stores it as a versioned record per job.
OpenAI's prompt engineering guide makes the same point from the writer's side: keep the content you use over and over at the beginning of the prompt. It also says to store production prompts in your application code, because reusable prompt objects are being deprecated and v1/prompts is scheduled to shut down on 30 November 2026. For a business, that means the stable part of every prompt should live as files the team owns and versions. Caching is an API feature rather than a ChatGPT app one, which is one of the differences our post on whether you can just use ChatGPT for content traces.
Cache hits, cache misses, and how long a cached prompt lives
A cache hit means the request reused a stored prefix and was billed at the cached rate for those tokens. A cache miss means it did not, so the prefix was processed in full and, usually, written to the cache for the next request. A hit is never promised. OpenAI's guide says cached states live on individual machines, that traffic above 15 requests per minute can lead to overflow routing, and that caches are not shared across organisations. Even a kept session, it says, doesn't guarantee a hit.
How long a cached prefix stays eligible
Short
a minimum of 30 minutes
Long
set with ttl in the Responses API
Brief
five to ten minutes of inactivity, up to an hour
A judgment, not a score
How long a prefix stays eligible depends on the model. On GPT-5.6 and later the default lifetime is a minimum of 30 minutes, and the Responses API adds a 12-hour minimum, set with prompt_cache_options.ttl, which the OpenAI API changelog dates to 20 October 2026. Earlier models work differently. Their in-memory entries typically stay active for around five to ten minutes of inactivity, up to an hour, and the models that support extended retention can keep entries for up to 24 hours. So the first fact to check in any workflow is which model each step calls, because the caching rules travel with the model, not with your account.
In a content system, timing matters as much as wording. A batch of drafts generated back to back hits the cache on every call after the first, while the same drafts spread across a working day may miss each time if the gaps outlast the lifetime. A daily pipeline like the morning digest in our guide to content automation with n8n runs at fixed times, so its reuse pattern is predictable. Our analysis of OpenAI's 12-hour prompt cache works through when the longer lifetime repays its dearer write, so we won't repeat that arithmetic here.
Prompt caching API pricing: what gets cheaper and what does not
Caching changes the rate on input tokens only, and it makes the first use of a prefix dearer before it makes the later ones cheaper. On GPT-5.6 and later, OpenAI's guide prices a cache write at 1.25 times the ordinary input rate for the 30-minute lifetime and 2.5 times for the 12-hour one, and a cache read at 0.1 times the ordinary rate on most of these models. These are total rates, not surcharges: each input token is billed once, as uncached, cached or written. OpenAI's API pricing page lists the per-model numbers, with separate columns for cached input and for 30-minute and 12-hour writes.
Where caching touches a content call’s bill
One content call
- Cached prefix the brand guide, billed at the read rate
- Uncached input the changing request, at the ordinary rate
- Output tokens the draft, untouched by caching
Rough shares — a shape, not a measurement
| Kind of token | Rate, against ordinary input | When you pay it | Where it shows in usage |
|---|---|---|---|
| Uncached input | 1 times | No cache read or write applied, or the part after the last breakpoint | The rest of input_tokens |
| 30-minute write | 1.25 times | A prefix is stored for the default lifetime | cache_write_tokens, as ttl_30m_tokens |
| 12-hour write | 2.5 times | A prefix is stored for the longer lifetime, Responses API only | cache_write_tokens, as ttl_12h_tokens |
| Cache read | 0.1 times, 0.05 on GPT-6.1 Sol and Terra | A request reuses a stored prefix | cached_tokens |
| Output | Unchanged | Every token the model writes | output_tokens |
The guide's own example shows why the write premium is usually worth paying. Across ten requests that share a prefix, one write and nine reads cost 2.15 times the prefix's input price, against ten times with no caching. Two models go further: the GPT-6.1 Terra model page prices cached input at 5% of the uncached rate, half the usual read rate, and the caching guide says the same of GPT-6.1 Sol.
Output is untouched. The guide says prompt caching does not change how the model generates output tokens, so a long draft costs the same to write whether its instructions came from the cache or not. In a content workflow the draft is often the larger part of each call. That is why we never quote caching as a percentage off the whole bill. It is a percentage off the repeated part of the input, and how much that matters depends on the shape of each workflow.
How to order a content prompt so the stable part caches
Order a content prompt from the slowest-changing layer to the fastest: the rules that hold for every client first, then one client's brand knowledge, then one platform's instructions, and only then today's topic and source. Each layer changes less often than the one after it, so each can end in its own breakpoint, and a new topic never disturbs the layers above it. Anything that varies per request, such as a date, a draft number or a reviewer's name, goes at the very end, which is where OpenAI's guide tells you to put timestamps and user-specific content. A single changing value near the top is the commonest reason a carefully written prompt never hits the cache.
A content prompt, in the order it caches
One content prompt, slowest layer first
- 01The rules that hold for every client
- 02One client’s brand knowledge
- 03Then one platform’s own instructions
- 04Today’s topic and source
- 05The date, draft number or reviewer’s name, at the very end
The prefix is more than the text, and that catches people out. OpenAI's guide lists the settings that change a cached prefix, among them the model, the tools with their order and schemas, parallel tool calls, the text output format, the reasoning effort and the verbosity. A workflow that raises the reasoning effort for one platform, or adds a tool only when a source is a web page, is quietly running two prefixes. The tool_choice setting in OpenAI's function calling guide is the safer way to stop a tool being used on one call, because it leaves the tool definitions, and so the prefix, exactly as they were.
Layering is an editorial decision as much as a technical one. Deciding what belongs in the agency-wide rules, what belongs to one client and what is specific to LinkedIn or YouTube is the same work as organising a business's knowledge so people can find it, which the knowledge architecture framework sets out in four layers. When that structure already exists, caching is mostly a matter of rendering it in order. A copy-and-paste prompt, like the ones in our prompt sets for content creation, is the hand-run version of the same idea: standing instructions written once, with the variable part left for the end.
Five clients, five prefixes: how an agency lays out caching
Take an agency running content for five clients, each with its own brand guidelines, writing style, service descriptions, content rules and platform instructions, and a workflow that produces several drafts a day for each. Laid out well, every call opens with the same agency layer: the house rules on structure, sourcing and what a draft must never claim. That layer caches once and is shared by all five clients. Next comes one client's layer, shared by every draft for that client and by nobody else, then the platform layer, then the day's brief. A LinkedIn post and a YouTube script for the same client therefore reuse everything above the platform line. If those clients' images are generated too, each one also needs a visual style brief kept alongside the guidelines, the record our Higgsfield AI visual style workflow describes. The same per-client separation applies to generated visuals, where our guide to Higgsfield AI for agency client work keeps each client's references, credits and approvals apart.
Two questions that decide an agency’s cache hits
Same order · calls close together
Every layer hitsthe agency layer caches once and each client’s layer is reused
Mixed order · calls close together
Agency rules cached twicetwo different prefixes hold the same house rules
Same order · calls spread thinly
Expires between callsthe 30-minute lifetime lapses, so group that client’s work into one run
Mixed order · calls spread thinly
A fresh write each timeno layer is reused, and only the usage fields show it
Left column: every client’s prompt keeps the same order
Right column: the order differs from one client to another
The layout keeps one client's voice out of another's drafts, which matters more than the money. Because each client's files sit in their own position, two clients' rules are never in the same prompt, and a reviewer can see from the request which client's files were sent. It also shows which client's prefix is too short to cache on its own. A client whose guide runs to a few hundred tokens falls under the 1,024-token minimum by itself and caches only because the agency layer above it makes the prefix long enough. The guide's break-even note points the same way: across ten requests, extending a prefix of at least 221 tokens to 1,024 can be cheaper, though we would rather add real approved examples than filler. Keeping each client’s files in their own place is the rule content automation for marketing agencies is built on, from the knowledge base to the approval record.
Where this layout fails is order and drift. If the workflow assembles the client layer before the agency layer for one client and after it for another, the agency rules end up cached twice, in two different prefixes. If someone edits a client's guide at noon, every call after that writes a fresh cache for that client, which is correct and costs a write. And if one client's calls are spread thinly across the day, a 30-minute lifetime may expire between them, which is the case where the longer lifetime or grouping that client's work into one run earns its place. None of these shows up in the drafts; all of them show up in the usage fields.
How Paper Eagle AI runs prompt caching in Claude Code and n8n
In the systems we build, Claude Code holds the knowledge and assembles the prompt, and n8n makes the call, waits for approval and keeps the record, so caching is designed in two places. In Claude Code, each layer of the prefix is a file in the client's own repository: the house rules, the brand guide, the do-not-say list, the approved examples and one file per platform, the typed files described in our guide to a knowledge base for AI content. A CLAUDE.md file for the content project tells Claude Code how those files fit together, and Claude Code's memory documentation explains how it reads that file at the start of every session. A small script, written and checked in Claude Code, joins the layers in the same order every time and checks that no date or per-request value has crept into a stable layer.
The client repository a cached prompt is built from
- client-repo/ the client’s own repository
- CLAUDE.md tells Claude Code how the files fit together
- prefix/ the stable layers, in the order they are sent
- rules.md structure, sourcing, what a draft must never claim
- brand.md one client’s voice and services
- do-not-say.md what the client never says
- examples/ drafts a person already approved
- platforms/ one file per platform
- join-layers joins the layers in the same order every time
n8n sends the request these files build, then waits for approval
That is the same discipline our guide to what a Content Operating System is applies to the knowledge layer, carried down to the exact bytes the model receives. Claude Code for content automation shows the rest of what that repository holds, file by file, and Claude Code is also where we change a layer when a client's services or voice move. Because the files are versioned, every change to a prefix has a date and an author, which is what lets a usage log explain a sudden run of cache writes.
n8n then sends the request. n8n's OpenAI node documentation lists options such as maximum tokens, temperature, reasoning, a previous response ID and the output format, but, as of 17 November 2026, no cache setting. So when a workflow needs explicit breakpoints or the 12-hour lifetime, we call the Responses API from n8n's HTTP Request node, which can send the body as JSON. Each step stays one workflow with one job, the way we structure every n8n build, so the call that caches can be found and changed on its own, and the draft still waits for a named person's approval.
Not every step runs on OpenAI. Many of our drafting steps run on Claude, and Anthropic's prompt caching documentation describes the same idea with different numbers: a 5-minute default and an optional 1-hour lifetime, writes at 1.25 and 2 times the base input price, reads at 0.1 times on most models, and a prefix built in the order tools, system, then messages. The layered files do not change between providers; only the script's last step does, marking OpenAI breakpoints for one and Anthropic cache_control blocks for the other. That portability is the reason to keep the prefix as owned files rather than as settings inside one vendor's dashboard, and it is how a Content OS built in Claude Code and n8n stays free to change models step by step.
Measuring savings with OpenAI cached input tokens and cache writes
You measure caching from the usage object on each response, not from the monthly invoice, and two fields do most of the work. In the Responses API reference, usage.input_tokens_details.cached_tokens counts the input tokens billed as cache reads, and the caching guide says it excludes tokens charged as writes. usage.input_tokens_details.cache_write_tokens counts the writes, split into ttl_30m_tokens and ttl_12h_tokens. Set those beside the total input tokens and you have, for every call, what was read, what was written and what was processed at the full rate, which multiplied by each rate gives the call's real input cost.
The usage fields that show what caching saved
- Cache reads
- cached_tokens, input billed as cache reads, writes excluded
- Cache writes
- cache_write_tokens, split into ttl_30m_tokens and ttl_12h_tokens
- Total input
- everything not read or written was processed at the full rate
- Diagnostics
- a hit or a miss, with a reason such as tools_changed
- The real input cost
- each count multiplied by its rate from the pricing page
In n8n, every run is an execution, and n8n's executions documentation describes how each one keeps the data its nodes returned. That means the usage object from the HTTP Request node can be written to a log row with the client, the platform, the model and the time. Read weekly, that log answers the questions that matter: which clients' prefixes are hitting, and which workflow writes a fresh cache on every call. We keep it beside the review record, as our guide to measuring whether a content system works argues, so a saving is always read next to the drafts it paid for.
When the hit rate is lower than expected, OpenAI's prompt cache diagnostics tell you why. Set prompt_cache_options.comparison_response_id to the id of an earlier response that should have shared the prefix, and the new response carries a prompt_cache_diagnostics object reporting a hit or a miss, with a reason such as model_changed, tools_changed, reasoning_effort_changed, context_compacted or input_changed. Diagnostics work in the Responses API for GPT-5.6 and later, they are best effort, and the comparison record expires after a short period. OpenAI's Prompt Caching 101 cookbook is still a readable introduction, but it predates the current lifetimes and field names, so treat it as background rather than reference.
What prompt caching does not do, and what stays with a person
Prompt caching lowers the price and processing time of repeated input; it does not lower output costs, raise rate limits, guarantee a hit or make a prompt any better. OpenAI's guide says cached input tokens still count toward tokens-per-minute limits, and OpenAI's rate limits guide sets those limits at the organisation and project level, so caching will not let a busy agency send more requests a minute. Entries expire, each model has its own rules, and a long conversation that is summarised or compacted can change its prefix and lose the cache by design. Teams with data rules should know that cache entries may be held as encrypted application state in GPU-local storage for up to 24 hours, which OpenAI's data controls page describes, and that the caching guide calls every caching feature compatible with Zero Data Retention.
What caching changes, and what it leaves alone
- Lowers the price of repeated input the repeated prefix is billed at the cached rate
- Lowers output costs the output is billed exactly as before
- Raises rate limits cached input tokens still count toward tokens-per-minute limits
- Guarantees a hit entries expire and each model has its own rules
- Makes the prompt better a wrong rule cached all day is applied to every draft that day
What stays human is everything inside the prefix. Caching makes a voice guide cheaper to repeat; it does not make it right, and a wrong rule cached all day is a wrong rule applied to every draft that day. Someone has to own each client's layer, decide when it changes and accept that every change starts a new cache. Someone still approves every draft before it goes out. What to automate in your content draws that line in general, and for caching it falls exactly at the edge of the prefix: the machine handles the repetition, and a person owns the words being repeated.
The other thing caching cannot fix is decay. A prefix that never changes is cheap, and a prefix that has not changed in a year is also out of date, because services move, the voice develops and platform rules shift. Why automated content stops working describes how that happens without anyone noticing. A good caching design makes updates cheap to roll out, since a change to one layer only rewrites the layers below it.
What caching saves a content workflow, and what it costs to set up
Caching saves most where a long, stable prefix is reused many times within its lifetime, and almost nothing where prompts are short, varied or rare. A drafting step that sends a brand layer of several thousand tokens dozens of times a day is the ideal case. A one-off research call with a fresh source and no standing instructions gains nothing, and a prefix used once a day can cost more with a long lifetime than with no explicit caching at all.
Where caching pays in a content workflow
Drafting step sent all day
Prefix used once a day
One-off research call
Short varied prompts
Across: how many times the same prefix is reused within its lifetime
Up: how long and stable the prefix is
The setup cost is mostly structure. Splitting the knowledge into layered files, writing the script that joins them in a fixed order, moving a call from n8n's OpenAI node to an HTTP Request with explicit breakpoints, and adding the usage log is modest work for a system that already keeps its knowledge in files. It is much more for one where the brand guide lives in someone's chat history, which is why automating content creation starts with the knowledge layer, not the drafting step. The software and model bills are usually the smaller part of the cost, as our breakdown of content automation software costs argues, and caching trims the model part further. The larger saving comes from the structure itself: fewer rewrites, because every draft starts from the same approved knowledge.
There is a running cost too. Every edit to a layer means a new write, every model change means a new prefix, and somebody has to read the usage log each week or the saving drifts away unseen. For work that can wait, OpenAI's Batch API guide describes lower prices for jobs completed within 24 hours. The cost of content automation with Claude and n8n covers the tool and model bills of our own stack in full, and our setup prices are on the content automation pricing page.
Frequently asked questions
Does OpenAI prompt caching work automatically, or do I have to turn it on?
It works automatically on supported models: OpenAI's guide says prompt caching is enabled by default, and the API places a breakpoint at the end of the latest eligible message. You switch to explicit mode only when you want to choose your own breakpoints or set the 12-hour lifetime with prompt_cache_options. Either way, the prefix must be at least 1,024 tokens on GPT-5.6 and later, and it must match exactly.
Does prompt caching work in the ChatGPT app?
No. Prompt caching is an API feature that changes how input tokens are billed, and the ChatGPT app is not billed per token, so there is nothing for it to discount. It matters when a workflow calls OpenAI's models through the API, from n8n, Zapier, Make or your own code, sending the same instructions on many calls. Our ChatGPT content guides cover the app side.
How can I tell whether a request hit the cache?
Read the usage object on the response: cached_tokens under input_tokens_details shows how many input tokens were billed as cache reads, and cache_write_tokens shows how many were written. If cached_tokens is zero when you expected a hit, the prompt cache diagnostics can compare the request with an earlier response and name the reason, such as a changed model or changed tools.
Will prompt caching let an agency send more requests before hitting rate limits?
No. OpenAI's guide says cached input tokens still count toward tokens-per-minute limits, and those limits are set at organisation and project level. Caching lowers the price of the repeated prefix, but the tokens are still counted.
Should each client of an agency have its own cached prefix?
Each client should have its own layer in the prefix, placed after a shared agency layer, so the shared rules cache once and each client's knowledge caches separately. Caches are not shared across OpenAI organisations, so if a client runs the workflow in its own account, its prefix is cached there and nowhere else. The layout also keeps one client's rules out of another client's prompt.
Is it worth caching a prompt that runs only once or twice a day?
Usually not, unless the calls fall within the cache's lifetime. A write costs more than ordinary input, so a prefix that is written and never read again costs more than no caching at all. For prompts that run rarely and can wait, the Batch API's lower prices are often the better saving.
Where to start
Pick the one workflow that runs most often and export a week of its calls. For each call, note the model, the length of the instructions it sends and the time it ran, then check how much of those instructions is identical from call to call. If the identical part is long and the calls cluster together, reorder the prompt so that part comes first, and watch cached_tokens for a week before changing anything else. If the identical part is short or keeps changing, the first job is not caching at all. It is writing the knowledge down in one place, in a fixed order, which is where a content operating system for your business begins.
Disclosure
This post was written by Shreyas Dave, founder of Paper Eagle AI. We sell content automation services, which is the category this article is about, so we have a commercial interest in you concluding that a system beats ad-hoc effort — read it knowing that. No tool vendor was involved in writing it, nobody paid for a mention, and there are no affiliate links anywhere on this site. Where a third-party figure appears, it’s attributed to the publisher it came from; anything we couldn’t source is written as a direction rather than a number.
Paper Eagle AI builds Content Operating Systems that turn a business’s knowledge and expertise into consistent, multi-platform content, and we deliver them as content automation services. Working as a content automation specialist, we capture what a business knows and how it sounds, set the strategy, and build the workflows that research, draft, repurpose and publish — with a named person approving every piece before it goes out. Every build runs through discovery, design, build and handoff. The system lives in the client’s own accounts, it is documented, the team is trained to run it, and the business owns it outright. We don’t write content on a retainer, and we don’t build lead generation, CRM or sales automation.
One source of thinking becomes native content for every platform a business publishes on: the founder’s LinkedIn and the company page, YouTube and Shorts, Instagram and Reels, TikTok, Reddit, Medium, newsletters, and the company’s own website, written to be found in Google and understood by AI search. Our multi-platform content automation page shows how they share one source, and our case studies document the systems behind our own publishing, file by file. You can follow the work on the company’s own channels: Paper Eagle AI on Instagram, Paper Eagle AI on YouTube, the Paper Eagle AI company page on LinkedIn, Paper Eagle AI on Substack, Paper Eagle AI on Reddit and Paper Eagle AI on Medium. Paper Eagle AI is also listed where clients can review its work: Paper Eagle AI on Clutch, Paper Eagle AI on GoodFirms and the Paper Eagle AI Google Business Profile.
Keep reading
- How to build a knowledge base for AI content — the typed files that become the stable layers of a cached prompt.
- How to structure n8n workflows for a content system — where the caching call sits, one job per workflow.
- The cost of content automation with Claude and n8n — the whole bill that caching trims one part of.