Commit Graph

1 Commits

  • feat(caching): implement Claude prompt caching with multi-turn support
    - Add ensureCacheControl() to auto-inject cache breakpoints
    - Cache tools (last tool), system (last element), and messages (2nd-to-last user turn)
    - Add prompt-caching-2024-07-31 beta header
    - Return original payload on sjson error to prevent corruption
    - Include verification test for caching logic
    
    Enables up to 90% cost reduction on cached tokens.
    
    Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>