Problem
Axe re-transmits the full system prompt (skill + files + memory), tool definitions, and message history on every turn of a multi-turn agent run. No provider currently sends cache hints, so users pay full input-token costs for static content on every API call. For agents with large SKILL.md files and many tool calls, this is a significant cost multiplier.
Goal
Add provider-side prompt caching support so that repeated static context (system prompt, tool schemas) is cached by the LLM provider after the first turn, reducing input-token costs on subsequent turns. Cache usage must be observable in verbose mode and JSON output.
Provider Support
| Provider |
Mechanism |
Request Change |
Response Change |
| Anthropic |
Explicit cache_control: {type: "ephemeral"} |
Add cache hints to system blocks and tool defs |
Parse cache_creation_input_tokens / cache_read_input_tokens |
| OpenAI |
Automatic prefix caching |
None (automatic) |
Parse usage.prompt_tokens_details.cached_tokens |
| Bedrock (Claude) |
cachePoint blocks |
Add cache points to system/tool config |
Parse cacheReadInputTokens / cacheWriteInputTokens |
| Gemini |
Context caching API |
Out of scope (requires stateful two-phase API) |
Out of scope |
| Ollama |
N/A |
None |
None |
| OpenCode |
Pass-through |
No gateway-level control assumed |
No changes |
Spec
See docs/plans/049_prompt_caching_spec.md for full requirements and implementation plan.
Acceptance Criteria
Problem
Axe re-transmits the full system prompt (skill + files + memory), tool definitions, and message history on every turn of a multi-turn agent run. No provider currently sends cache hints, so users pay full input-token costs for static content on every API call. For agents with large SKILL.md files and many tool calls, this is a significant cost multiplier.
Goal
Add provider-side prompt caching support so that repeated static context (system prompt, tool schemas) is cached by the LLM provider after the first turn, reducing input-token costs on subsequent turns. Cache usage must be observable in verbose mode and JSON output.
Provider Support
cache_control: {type: "ephemeral"}cache_creation_input_tokens/cache_read_input_tokensusage.prompt_tokens_details.cached_tokenscachePointblockscacheReadInputTokens/cacheWriteInputTokensSpec
See
docs/plans/049_prompt_caching_spec.mdfor full requirements and implementation plan.Acceptance Criteria
provider.Requestand cache metrics toprovider.Responsecache_controlon system prompt and parses cache usagecached_tokensfrom API responsescachePointblocks and parses cache usage