Commit Graph
4 Commits
Author SHA1 Message Date
lukaszraczylo 86870668ea fix(anthropic): keep system a string when marked parts are empty 2026-11-26 01:53:51 +00:00
lukaszraczylo 2fe798ad82 fix(openai): forward prompt_cache_key on translated messages only when enabled
The translated messages path copied any prompt_cache_key into the
upstream body, even with promptCache.key off. It now forwards the key
only when the provider opted in. The gateway key travels in a private
field, and a client key wins when present.
2026-11-26 01:37:52 +00:00
lukaszraczylo cff1761a21 feat(openai): opt-in per-conversation prompt_cache_key
When promptCache.key is set on an openai provider, the gateway sends a
hashed prompt_cache_key per conversation. The key is the SHA-256 of the
caller id and the session id. The session id is the client id, or the
system prompt plus the first user message.

The key is set only when the client sent no prompt_cache_key. It is set
on each attempt copy after the response-cache key is computed. It is not
stored, and it never carries a raw id.
2026-11-26 01:33:56 +00:00
lukaszraczylo 5ffd44874c feat(anthropic): opt-in rolling prompt-cache breakpoints
Add providers.<name>.promptCache with inject and key flags. When inject is true on an anthropic provider, the gateway adds up to four cache_control breakpoints. They go on the last tool, the last system block, and the last two user messages. The translated chat path and the /v1/messages passthrough both use it. A body that already has any cache_control is left unchanged. The input body is never mutated. The default config changes no request body.
2026-11-26 01:28:51 +00:00