Description
Implement prompt/context caching using provider-specific options (e.g., Anthropic's cacheControl breakpoints or OpenAI's automatic prefix caching). Since the system prompt, tool schemas, and conversation history are resent every turn, caching these prefixes will drastically cut latency and cost.
Use Case
For multi-turn sessions with large system prompts and tool definitions, users currently pay token costs and latency penalties on every turn for static context.
Proposed Solution
Modify source/ai-sdk-client/chat/provider-options.ts to set cache-control hints. Mark stable prefixes (system prompt + tool definitions) as cacheable.
Alternatives Considered
None. This is a native feature of newer model APIs that just needs to be wired up.
Additional Context
Implementation Notes
This is the single highest-leverage change identified for reducing multi-turn latency and cost.
Description
Implement prompt/context caching using provider-specific options (e.g., Anthropic's
cacheControlbreakpoints or OpenAI's automatic prefix caching). Since the system prompt, tool schemas, and conversation history are resent every turn, caching these prefixes will drastically cut latency and cost.Use Case
For multi-turn sessions with large system prompts and tool definitions, users currently pay token costs and latency penalties on every turn for static context.
Proposed Solution
Modify
source/ai-sdk-client/chat/provider-options.tsto set cache-control hints. Mark stable prefixes (system prompt + tool definitions) as cacheable.Alternatives Considered
None. This is a native feature of newer model APIs that just needs to be wired up.
Additional Context
Implementation Notes
This is the single highest-leverage change identified for reducing multi-turn latency and cost.