feat(llm): support GPT-5.6 prompt cache new options#36320
Open
AbdoKnbGit wants to merge 1 commit into
Open
Conversation
Contributor
|
The following comment was made by an LLM, it may be inaccurate: Based on my search, there is one related PR that might be worth noting: Related PR (not a duplicate):
The current PR (36320) is focused on adding GPT-5.6 specific prompt caching support with Conclusion: No duplicate PRs found for the GPT-5.6 prompt caching feature. PR #35982 addresses caching improvements more generally but is not a duplicate. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #36318
Type of change
What does this PR do?
Adds GPT-5.6 prompt caching support while keeping older OpenAI models on their existing behavior.
For the GPT-5.6 family, including
gpt-5.6,gpt-5.6-sol,gpt-5.6-terra,gpt-5.6-luna, and suffix-style variants likegpt-5.6-fast, opencode now sends OpenAI request-wide prompt cache options:That lowers to OpenAI wire field:
prompt_cache_options: { mode: implicit, ttl: 30m }The existing
prompt_cache_keybehavior remains in place. GPT-5.5 and older models do not receiveprompt_cache_options, so they keep the old cache behavior.This also parses
cache_write_tokensin OpenAI usage responses so cache writes are counted separately from cached reads and normal input tokens.OpenAI docs: https://developers.openai.com/api/docs/guides/prompt-caching
How did you verify your code works?
Ran these locally:
bun testfrompackages/llm— all tests pass.bun typecheckfrompackages/llm— passes.bun test test/session-runner.test.tsfrompackages/core— all tests pass.bun typecheckfrompackages/core— passes.bun test --timeout 60000 test/provider/transform.test.tsfrompackages/opencode— all tests pass.Checklist