Files
zed/crates/language_models_cloud
Bennet Bo Fenner 10d1b2a564 Preserve prompt caching for OpenAI Responses (#67245)
Starting with GPT-6.2, OpenAI [appends top-level `instructions` after
`input`](https://developers.openai.com/api/docs/guides/prompt-caching#how-prefix-matching-works),
outside the cacheable prefix. [Like
Codex](https://github.com/openai/codex/blob/9f2b87495bf979f6c1953cf00c98143981664914/codex-rs/core/src/client.rs#L1283-L1292),
send Zed’s reusable system prompt as a leading `developer` message,
including when replaying a native compaction window.

Verified in a local Zed build with GPT-6.2 Sol: 98.4% of input tokens
were cached on the final request. A live native-compaction replay probe
also hit the cache on all four follow-up requests. All 137 focused tests
passed.

Release Notes:

- Fixed prompt caching for reusable OpenAI system instructions on
GPT-6.2 and later.
2026-11-20 14:12:45 +00:00
..