Techniques Catalog

The full toolbox of token-saving techniques, sorted by category. Each card shows typical savings, effort, and where it applies.

Prompt caching (stable prefixes)

CachingVery High impactLow effort

Reuse an unchanged prompt prefix instead of re-paying to process it. The single highest-leverage lever for repeated or multi-turn workloads.

  • Put the most stable content FIRST: system prompt, role, policies, tool definitions, large reference docs.
  • Put the volatile, per-request content (the user's actual question) LAST.
  • Keep the prefix byte-identical across calls — even a date or whitespace change busts the cache.
  • On Claude, mind the 5-minute TTL (early-2026 change): fire a lightweight keepalive every ~4 min for high-value caches, or pay for the 1-hour TTL when the workload warrants it.
Typical savings: Cached reads cost ~90% less (Claude & Gemini); 50–90% less (OpenAI).
Applies to: Claude API, OpenAI API, Gemini API, Bedrock, Vertex AI

Watch out: Cache writes cost MORE than base input (Claude: +25% for 5-min, +100% for 1-hour). Caching only pays off when the prefix is reused enough times within the TTL.

Caveman / semantic compression

Prompt CraftMedium impactLow effort

Strip grammatical scaffolding (articles, auxiliary verbs, pronouns, intensifiers) while preserving the load-bearing words (nouns, verbs, numbers, names, technical terms).

  • Apply to system messages, few-shot examples, chat logs, and reference docs you re-feed each session.
  • Keep: nouns, main verbs, meaningful adjectives, numbers, uncertainty qualifiers, critical prepositions, time/frequency markers, names, technical terms.
  • Drop: articles (a/the), auxiliary verbs, redundant prepositions, pronouns, pure intensifiers.
  • Pair with prompt caching — compress the doc once, cache the compressed version, reuse cheaply.
Typical savings: 14–21% on real coding tasks; up to 39–45% vs a plain 'be terse' instruction.
Applies to: Any chat, Agent pipelines, RAG context

Watch out: Avoid on nuanced reasoning, legal/medical precision, or creative writing where grammar carries meaning. Best for directive tasks: code gen, data transforms, classification.

Model routing & tiering

Model StrategyVery High impactMedium effort

Match model power to task difficulty. Use budget models for classification, extraction and drafting; reserve flagships for hard reasoning.

  • Classify each request's complexity (cheaply, with a small model or rules) before choosing a model.
  • Default to the cheapest tier that passes your quality bar; escalate only on failure or low confidence.
  • In agent stacks, route subagent/tool work to cheap models — agent teams burn ~7x more tokens than single sessions.
  • Examples: Claude Haiku → Sonnet → Opus; Gemini Flash → Pro; GPT-5.x Nano/Mini → full.
Typical savings: Budget tiers cost 15–50x less than flagships; blended spend often drops 40–60%.
Applies to: All providers, Agent frameworks, Cursor, Copilot

Context editing / pruning

Context EngineeringHigh impactMedium effort

Remove stale tool results and thinking blocks once they are no longer relevant, instead of carrying them forward every turn.

  • Prune old tool outputs, logs, and intermediate reasoning that no longer affect the next step.
  • On Claude, use built-in context editing thresholds; in your own apps, trim the message array before each call.
  • Keep structural anchors (task, constraints, current state) — drop the exhaust.
Typical savings: Cuts carried context 30–70% in long agent loops.
Applies to: Claude, Custom agents, LangGraph-style loops

Compaction / history summarization

Context EngineeringHigh impactLow effort

Condense earlier conversation into a short summary so the thread can continue without re-sending the full transcript.

  • Summarize at a threshold (e.g. 60–70% of window) into a compact state object.
  • Claude Code: run /compact at natural breakpoints; /clear between unrelated tasks.
  • Persist a 'handoff' summary (decisions, open questions, current files) and drop raw history.
Typical savings: Keeps long sessions inside a small window; avoids quadratic context growth.
Applies to: Claude Code, ChatGPT, Custom chat apps

Retrieve, don't stuff

RetrievalVery High impactHigh effort

Feed only the relevant chunks via RAG instead of pasting whole documents or codebases into the prompt.

  • Index your corpus; retrieve top-k relevant chunks per query.
  • Tune k and chunk size — more is not better; it adds tokens and dilutes attention.
  • Let a small model reason over retrieved context instead of fine-tuning or prompting a giant model on everything.
Typical savings: 30–50% lower per-request cost vs context stuffing.
Applies to: Production apps, Knowledge assistants, Support bots

Prompt compression (LLMLingua-style)

Prompt CraftHigh impactHigh effort

Use a compressor model to drop low-information tokens from long prompts/retrieved chunks while preserving answerability.

  • Run retrieved RAG chunks through a compressor before sending to the expensive model.
  • Compress few-shot example banks aggressively; they are mostly redundant.
  • Validate answer quality on a held-out set before raising compression ratio.
Typical savings: 2–20x prompt reduction on RAG-heavy pipelines.
Applies to: RAG pipelines, API products

Semantic caching (app-level)

CachingHigh impactMedium effort

Match semantically similar queries to a cached answer and skip the model call entirely.

  • Embed incoming queries; if cosine similarity to a prior query exceeds a threshold, return the cached answer.
  • Great for FAQ-shaped traffic, repeated support questions, and common classifications.
  • Set TTL and invalidation rules so answers don't go stale.
Typical savings: Eliminates 100% of cost on cache hits; hit rates of 20–60% common in FAQ traffic.
Applies to: Production apps, Redis/vector cache

Batch / async processing

Model StrategyHigh impactLow effort

Send non-urgent work through batch endpoints for a flat discount.

  • Queue offline jobs (evals, enrichment, backfills, summaries) to the Batch API.
  • OpenAI & Anthropic batch ≈ 50% off; stacks with prompt caching.
  • Accept up-to-24h turnaround (most finish in 1–6h).
Typical savings: 50% off input+output; up to ~75% when stacked with caching.
Applies to: OpenAI Batch, Anthropic Batch, Vertex batch

Output control

Output ControlHigh impactLow effort

Output tokens are usually the priciest. Cap and shape them.

  • Set max_tokens / max_output_tokens to a real ceiling.
  • Ask for terse answers and a specific format; forbid preamble and restated questions.
  • Use structured output / JSON schema and stop sequences to end generation early.
  • Disable verbose chain-of-thought when the task doesn't need it; enable extended thinking only when it pays.
Typical savings: 20–60% on output spend.
Applies to: All providers

Persistent instruction files

Context EngineeringMedium impactLow effort

Encode conventions once in a project memory file instead of repeating them in every prompt.

  • Claude Code: CLAUDE.md. Cursor: .cursor/rules (.cursorrules). Copilot: .github/copilot-instructions.md. Agents: AGENTS.md.
  • Keep them lean — they ride in context on every call.
  • Store stable architecture, naming, and 'do/don't' rules; not volatile task detail.
Typical savings: Removes repeated boilerplate from every prompt; improves first-pass accuracy.
Applies to: Claude Code, Cursor, Copilot, Coding agents

Few-shot diet

Prompt CraftMedium impactLow effort

Use the fewest, shortest examples that hit your quality bar — and cache them.

  • Trim example count; test where quality plateaus.
  • Move the example bank into a cached system prefix so you pay for it once per TTL.
  • Prefer one excellent example over five mediocre ones.
Typical savings: Often halves prompt size on classification/extraction tasks.
Applies to: Classification, Extraction, Structured tasks

Send diffs, not whole files

Context EngineeringMedium impactLow effort

Reference or diff instead of re-pasting entire files/datasets each turn.

  • Share only the changed lines or a pointer/path the agent can read on demand.
  • Strip comments, minify JSON, and dedupe boilerplate where safe.
  • Use tool-based file reads so the model pulls only what it needs.
Typical savings: Large in coding loops where files are otherwise re-sent every turn.
Applies to: Cursor, Claude Code, Copilot, Custom agents

Agent token budgets & guardrails

Agentic WorkflowHigh impactMedium effort

Cap loops, steps, and tool calls so a runaway agent can't silently burn a fortune.

  • Set max-steps, max-tool-calls, and a hard token budget per task.
  • Add early-exit on success and confidence checks before escalation.
  • Log per-task token spend and alert on outliers.
Typical savings: Prevents tail-risk blowouts; agent runs use ~7x tokens unguarded.
Applies to: Agent frameworks, Multi-agent systems

Distillation & small fine-tunes

Model StrategyHigh impactHigh effort

Train a small model on your repetitive task using flagship outputs, then serve the cheap model.

  • Collect high-quality flagship outputs for a narrow, high-volume task.
  • Fine-tune a lightweight model (or distill) and route that traffic to it.
  • Keep the flagship as a fallback for low-confidence cases.
Typical savings: 10–50x on the distilled slice of traffic.
Applies to: High-volume narrow tasks, Self-host / managed fine-tune

Metering, tagging & dashboards

FinOps & GovernanceHigh impactMedium effort

You can't optimize what you can't see. Tag every call by feature/team/use-case and watch unit economics.

  • Attach metadata (feature, team, customer, env) to every request.
  • Track cost per 1K calls, tagging coverage %, and budget utilization %.
  • Set budgets and anomaly alerts; review in regular FinOps cadences.
Typical savings: Indirect but compounding — surfaces the waste the other levers fix.
Applies to: Org-wide, Platform teams