Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.
docs(agent): note which usage paths can report a zero cache read
thinhlpg8a9484abbe39
diff --git a/docs/src/pages/docs/agent/context.mdx b/docs/src/pages/docs/agent/context.mdxindex 199072ce6..f1b9b63c6 100644--- a/docs/src/pages/docs/agent/context.mdx+++ b/docs/src/pages/docs/agent/context.mdx@@ -77,6 +77,11 @@ reports no cache field at all says `Prompt cache: not reported`, and only once abeen measured. Those are different answers and are never conflated: the first is a cold cache,the second is silence.+One provider-layer caveat: on a `chat/completions` route the upstream client collapses a `0` cache+counter into "field absent" while parsing, so a provider that honestly reports `cached_tokens: 0`+reads as `not reported` there - the zero never reaches the readout. Anthropic and Responses+providers, whose usage Jan translates itself, keep the zero and do render the `0%` alarm.+## Where the window size comes fromIn order of precedence:diff --git a/src-tauri/src/core/agent/genai_bridge.rs b/src-tauri/src/core/agent/genai_bridge.rsindex 75fb69d4a..8f8751771 100644--- a/src-tauri/src/core/agent/genai_bridge.rs+++ b/src-tauri/src/core/agent/genai_bridge.rs@@ -555,13 +555,18 @@ fn completion_json(// mixing an Anthropic-native top-level key into a chat-shaped usage.//// Caveat worth knowing before trusting a missing field: the client- // crate deserializes usage with `zero_as_none`, so a route that- // honestly reports `cached_tokens: 0` (a prefix written every turn- // and never read -- the expensive case) arrives here looking like a- // route that reports no cache field at all. Which of the two it was- // cannot be recovered at this layer; the TUI reads it as "not- // reported". A converted (Anthropic/Gemini/codex) stream keeps the- // raw usage object, so its zeros do survive.+ // crate deserializes usage with `zero_as_none` (`PromptTokensDetails+ // .cached_tokens` included), so a route that honestly reports+ // `cached_tokens: 0` (a prefix written every turn and never read --+ // the expensive case) arrives here looking like a route that reports+ // no cache field at all. Which of the two it was cannot be recovered+ // at this layer; the console reads it as "not reported", so a+ // cold-prefix route on this bridge cannot raise the zero-hit alarm.+ //+ // Native providers do not come through here: `core::server+ // ::converters` builds the chat-shaped usage itself and emits the+ // cache fields whenever the upstream reported them, a zero included,+ // so Anthropic and Responses routes keep the distinction.let mut d = serde_json::Map::new();if let Some(v) = details.cached_tokens {d.insert("cached_tokens".into(), serde_json::json!(v));