Watch
1
0
Fork
You've already forked souveraine
0

claude: log the cache split per call

A cache hit and a short prompt are indistinguishable from outside;
this provider logged nothing per request at all, which is how an
uncached bridge went unnoticed across 93 turns.
This commit is contained in:
Fimeg 2026-08-10 13:33:54 -04:00
commit dfc89d09ea

View file

@ -379,7 +379,20 @@ impl LlmProvider for ClaudeSubscriptionProvider {
let status = resp.status();
if status.is_success() {
let text = resp.text().await.context("reading claude response body")?;
return parse_completion(&text).map(|r| (r, strain));
let result = parse_completion(&text)?;
if let Some(usage) = &result.usage {
// Without this the cache is invisible: a hit and a short
// prompt look identical from the outside.
info!(
model = %model,
prompt = usage.prompt_tokens,
cache_read = usage.cache_read_tokens,
cache_write = usage.cache_write_tokens,
output = usage.completion_tokens,
"claude usage"
);
}
return Ok((result, strain));
}
let body_text = resp.text().await.unwrap_or_default();