Skip to content

Conversation

solomon-8
Copy link

Describe the change
This PR adds support for Claude Code’s prompt cache capability by introducing new request/response fields in the client.
The added fields allow developers to leverage caching in Claude’s code model prompts, which helps reduce cost and latency when reusing prompt context.

Describe your solution

Added new struct fields in the request/response models to represent prompt cache parameters.

Updated client methods to correctly marshal/unmarshal these new fields.

Changes are backward compatible — no existing APIs are broken.

No external dependencies introduced.

Additional context
This PR addresses the need for developers to use Claude Code’s caching ability directly in go-openai.
Related branch: sashabaranov/issues_897

Issue: #897

Copy link

codecov bot commented Aug 20, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.59%. Comparing base (f71d1a6) to head (11edd23).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1068   +/-   ##
=======================================
  Coverage   99.59%   99.59%           
=======================================
  Files          34       34           
  Lines        2206     2206           
=======================================
  Hits         2197     2197           
  Misses          6        6           
  Partials        3        3           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant