How to use cache context?
Hey, how to use cached prompts?I have a fixed long system prompt for all request, i want it to cache it and use it. how to pass this cache prompt to claude code sdk.
I used to make this system config when i used regualr claude api, but now in claude code i see the system prompt only get string type.
Prompt caching is handled automatically by the SDK and the underlying Claude Code CLI. The system prompt and tool definitions are automatically cached by the API — you don't need to configure cache breakpoints manually like with the direct Claude API.
When you use system_prompt in ClaudeAgentOptions, the SDK passes it to the CLI which handles caching transparently. You can verify caching is working by checking cache_read_input_tokens in the ResultMessage.usage field.
The SDK intentionally provides a simpler interface than the raw API — you pass a string system prompt and caching is handled for you. Closing as answered.