diff --git a/HISTORY.md b/HISTORY.md index 33c90adb8..5c79b7f84 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -3,7 +3,8 @@ ### main branch -- Prompt cache keepalives, via `--cache-keepalive-pings`. +- Keep your prompt cache from expiring with `--cache-keepalive-pings`. + - Pings the API every 5min to keep the cache warm. - You can now bulk accept/reject a series of add url and run shell confirmations. - Improved matching of filenames from S/R blocks with files in chat. - Stronger prompting for Sonnet to make edits in code chat mode. diff --git a/aider/website/HISTORY.md b/aider/website/HISTORY.md index ca54c57e3..d730b1af0 100644 --- a/aider/website/HISTORY.md +++ b/aider/website/HISTORY.md @@ -18,7 +18,8 @@ cog.out(text) ### main branch -- Prompt cache keepalives, via `--cache-keepalive-pings`. +- Keep your prompt cache from expiring with `--cache-keepalive-pings`. + - Pings the API every 5min to keep the cache warm. - You can now bulk accept/reject a series of add url and run shell confirmations. - Improved matching of filenames from S/R blocks with files in chat. - Stronger prompting for Sonnet to make edits in code chat mode. diff --git a/aider/website/assets/prompt-caching.jpg b/aider/website/assets/prompt-caching.jpg new file mode 100644 index 000000000..662d80591 Binary files /dev/null and b/aider/website/assets/prompt-caching.jpg differ diff --git a/aider/website/docs/usage/caching.md b/aider/website/docs/usage/caching.md new file mode 100644 index 000000000..abf07d6c6 --- /dev/null +++ b/aider/website/docs/usage/caching.md @@ -0,0 +1,44 @@ +--- +title: Prompt caching +highlight_image: /assets/prompt-caching.jpg +parent: Usage +nav_order: 750 +description: Aider supports prompt caching for cost savings and faster coding. + +--- + +# Prompt caching + +Aider supports prompt caching for cost savings and faster coding. +Currently Anthropic provides caching for Sonnet and Haiku, +and DeepSeek provides caching for Coder. + +![Prompt caching](/assets/prompt-caching.jpg) + + +## Usage + +Run aider with `--prompt-caching` or add that setting to your +[configuration files](/docs/config.html). + +Due to limitations in the provider APIs, caching statistics and costs +are not available when streaming responses. +To turn off streaming, use `--no-stream`. + +When caching is enabled, it will be noted for the main model when aider launches: + +``` +Main model: claude-3-5-sonnet-20240620 with diff edit format, prompt cache, infinite output +``` + +## Preventing cache expiration + +Aider can ping the provider to keep your prompt cache warm and prevent +it from expiring. +By default, Anthropic keeps your cache for 5 minutes. +Use `--prompt-keepalive-pings N` to tell aider to ping +every 5 minutes to keep the cache warm. +Aider will ping up to `N` times over a period of `N*5` minutes +after each message you send. + +