Keep the opening text stable
- Put fixed system instructions and character descriptions first.
- Keep timestamps, random macros and changing scene notes out of the opening instructions.
- Place changing lorebook entries later where your app permits it. Inserting a new entry near the start changes everything after that point for prefix matching.
- Append new turns without rewriting earlier messages. Editing old replies, switching prompt templates or summarizing history changes the prefix.
A worked cost example
On November 29, 2026, the live catalog listsdeepseek/deepseek-v4.1-flash-1017-uncensored at $0.33 per million ordinary input tokens, $0.011 per million cached input tokens and $1.32 per million output tokens.
For 100,000 input tokens and 1,000 output tokens:
- No cache hit:
100,000 × $0.33 / 1,000,000 + 1,000 × $1.32 / 1,000,000 = $0.03432. - With 95,000 input tokens actually read from cache:
5,000 × $0.33 / 1,000,000 + 95,000 × $0.011 / 1,000,000 + 1,000 × $1.32 / 1,000,000 = $0.004015.
cacheReadInputPer1kTokens is per thousand.
Check the hit, not just the setting
In API responses, look for positiveusage.cache_read_input_tokens or usage.prompt_tokens_details.cached_tokens. Streaming API callers can request the final usage event with stream_options: { "include_usage": true }. Some frontends do not display these fields; a lower response time alone does not prove a cache hit.
NanoGPT’s caching: true option requires a cache-capable route, but does not guarantee a hit. Each provider has its own cache, so switching providers or models can require rebuilding it. Leave cross-provider fallback available unless you accept failures in exchange for keeping a route fixed.
SillyTavern and Claude
SillyTavern’s native NanoGPT source supports Claude cache enablement and TTL through its Claude configuration. The release source checked on November 29, 2026 does not forwardclaude.cachingAtDepth in the NanoGPT branch. Do not assume that changing that depth setting places a NanoGPT cache boundary.
Claude explicit cache controls can select pay-as-you-go billing on Chat Completions, even for subscription users. Read prompt caching before enabling them. The open-source model example above uses implicit caching and does not require Claude cache markers.