feat(examples): add prompt caching test script

Standalone TypeScript script (zero deps, native fetch) to verify
Anthropic prompt caching is active. Documents 4 production gotchas
not in official docs: beta header required for Claude 4.x, effective
threshold ~2048+ tokens, cached tokens excluded from input_tokens,
new nested cache_creation response format.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Florian BRUNIAUX 2026-03-13 17:17:31 +01:00
parent b6ce1ef72f
commit aafb412fa4
3 changed files with 145 additions and 0 deletions

View file

@ -26,6 +26,7 @@ Utility scripts for Claude Code power users.
| `rtk-benchmark.sh` | Benchmark RTK token savings vs raw commands |
| `sync-claude-config.sh` | Sync Claude config files across machines |
| `sonnetplan.sh` | Run Claude with Sonnet replacing Opus (cost optimization alias) |
| `test-prompt-caching.ts` | Verify Anthropic prompt caching is active (no deps, fetch only) |
---