Restructure Production Prompts for Cross-Provider Prompt Caching
Get a refactored prompt layout separating static prefixes from dynamic inputs, plus a token cache-hit savings table for OpenAI, Anthropic, and Gemini.
Text prompt for Claude and Gemini
You get: Cache-Breaking Issues Found, restructured Prompt Layout and cross-Provider Cache-Hit Table
Prompt
Act as a staff LLM infrastructure engineer specializing in API cost optimization.
I will paste a production prompt and my approximate monthly request volume right after this message. Your job is to restructure the prompt so the static prefix maximizes prompt caching across OpenAI, Anthropic, and Gemini without changing the model output.
Follow these rules:
1. Move all immutable content (system role, rules, output schemas, few-shot examples, and reference docs) to the very top, and push all per-request variables (dates, user IDs, retrieved chunks, and user queries) to the bottom.
2. Flag any dynamic text currently embedded inside the static prefix that would invalidate cache hits.
3. Estimate the static prefix token count and check it against minimum caching thresholds: 1,024 tokens for OpenAI, 1,024 to 2,048 tokens for Anthropic Claude, and 1,024 to 4,096 tokens for Gemini.
4. Explain where to place Anthropic cache-control breakpoints and Gemini cached content boundaries in plain prose.
Output format:
- Cache-Breaking Issues Found: numbered list of dynamic elements polluting the prefix.
- Restructured Prompt Layout: ordered sections labeled Static Prefix and Dynamic Suffix.
- Cross-Provider Cache-Hit Table: Markdown table with columns for Provider, Minimum Threshold, Prefix Status, and Estimated Monthly Savings at 80% Hit Rate.
End with one line noting token-count assumptions and cache TTL expiration risks.Example output
Tips and common edits
Why this works
- Forces strict separation of immutable prefix blocks from per-request variables so byte-exact cache keys actually hit.
- Checks your static prefix against the real minimum token thresholds for OpenAI, Anthropic, and Gemini instead of guessing.
- Produces a concrete monthly savings table at an 80% hit rate so you can justify the refactor to engineering leadership.
Use this when your LLM API bill is climbing from repeated system instructions or few-shot examples. Paste your current prompt and approximate monthly request volume into Claude, Gemini, or ChatGPT.
Common edits
- Add your exact model names and per-million-token pricing if you use smaller tiers like GPT-4o mini, Claude Haiku, or Gemini Flash.
- Ask for a second cache breakpoint after your tool definitions if your agent passes more than 10 function schemas.
Reuse it: Use in a workflowTurn into a skillAdapt in the builder
Prompt details
- By
- Prompts-GPT editors
- Published
Did this prompt work?
More like this
Harden JSON Extraction with Strict Null and Fallback Rules
Get a hardened extraction prompt, strict schema specification, and edge-case test table that enforce null-over-guessing, enum fallbacks, and error handling.
Migrate Tool-Calling Schemas Across OpenAI, Claude, and Gemini
Convert your existing function definitions into native OpenAI, Anthropic Claude, and Google Gemini tool specs with a schema compatibility matrix.
Optimize Multi-Step Prompt Chains to Cut Latency and Spend
Get a before-and-after execution graph, parallelization plan, and token-cost breakdown to merge redundant LLM calls and cut prompt-chain latency.
Calculate Context Window Budgets for Long-Document Prompts
Generates a token allocation plan across input docs, scratchpads, and outputs for ChatGPT, Claude, and Gemini to prevent context overflow.
Compress Production Prompts to Reduce Token Usage and Latency
Compress high-volume system instructions into concise directives, showing exact deletions and estimated token savings.
Convert Complex System Prompts into Few-Shot Training Pairs
Transforms dense system instructions into five high-quality input-output pairs that clarify model expectations and edge-case handling.
- Migrate OpenAI System Prompts to Claude XML Format
- Convert Few-Shot Prompts to Claude Assistant Prefill Format
- Model Routing Config and Router Script Based on Cost, Latency, and Data Sensitivity
- Audit AI Prompts for Universal Compatibility and Portability
- Create Automated Regression Test Suites for AI Prompt Migrations
- Map Application Features to AI Model Tiers