Skip to main content
Long roleplay chats resend character instructions and earlier messages on each turn. Models with cached-input pricing can charge less when their host reuses an unchanged opening portion of that request.

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.
Implicit caching needs no extra request flag on supported routes. A model’s context limit is not a promise that its entire history will be cached. Minimum prefix sizes, expiration and routing changes can prevent reuse.

A worked cost example

On November 29, 2026, the live catalog lists deepseek/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.
The second request costs about 88% less in this example. That assumes the stated hit; the first request with a new prefix has no existing cache to read. Check current rates in the live catalog. Its prompt and completion prices are per million tokens; cacheReadInputPer1kTokens is per thousand.

Check the hit, not just the setting

In API responses, look for positive usage.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 forward claude.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.