Optimize your agent

Pay less per token

Prompt caching

When every run opens with the same tools and system prompt, the model provider can cache that prefix and bill repeat reads at a fraction of the input price. Put stable content first and changing content last, so the cached prefix survives from one run to the next.

Cache hits bill at $0.20 per million tokens on Claude Opus 5.5 and $0.10 on Sonnet 5.5 (0.05x their input price), and $0.01 on Haiku 5.5 (0.1x). Published list price

Checked on the vendor's pages 30 Nov 2026

Where it fits

Building my own agent Fits

cache_control on the Claude API; automatic on OpenAI.

Using a coding agent Partly

The harness caches for you.

Using an enterprise assistant Partly

The vendor caches for you.

Using a workflow tool Not confirmed

Depends on the model node.

The setting in each harness

Read on each vendor's own page, linked next to the setting.

HarnessSetting
Claude API and Agent SDK

cache_control: {"type": "ephemeral"} after the tools and system prompt

platform.claude.com, read 30 Nov 2026
OpenAI Responses and Agents SDK
On by default

Long, repeated prefixes are cached automatically; keep the prefix stable

developers.openai.com, read 30 Nov 2026
Claude Code
On by default

The prompt is cached for you; ENABLE_PROMPT_CACHING_1H=1 keeps it an hour on API keys

code.claude.com, read 30 Nov 2026