Repository navigation
@agent-native/recap-cli@0.5.10
Patch Changes
-
Release all public npm packages with a patch version bump.
-
a4b36e0: Stop billing cached prompt tokens twice, and normalize what
inputTokensmeans
across every engine.Providers disagree: OpenAI's
prompt_tokensincludes cached tokens, Anthropic's
input_tokensexcludes them. Theusageevent never said which it carried, so
both conventions reachedcalculateCost, which chargedinputTokensat the
full input rate and then addedcacheReadTokens/cacheWriteTokenson top.
On a long cached conversation the cache is nearly the whole prompt, so a turn
that cost $0.0054 was reported as $0.0478 — and everytoken_usagerow for an
OpenAI-family model was inflated the same way.- The
usageevent now documents one convention:inputTokensis the whole
prompt and INCLUDES both cache counts, which are a slice of it rather than an
addition. This matches the AI SDK's owninputTokens.total/noCache/
cacheRead/cacheWritenormalization, and the Builder gateway. anthropic-enginewas the only ENGINE reporting the exclusive form. It now
adds the cache counts back, which also fixes its prompt size: a fully cached
turn used to report ~3 input tokens instead of the real 42,438.calculateCosttreats the three counts as a partition and prices each token
exactly once. Callers with no prompt caching pass zeroes and are unaffected.
The recap CLI carried all three conventions at once and now shares this one:
parseClaudeUsageadds Anthropic's cache counts back into the prompt,
parseCodexUsageno longer strips OpenAI's cached tokens out of it (it did that
to compensate for the old pricing formula, so keeping both would have swung the
error the other way), andparseOpenAiCompatibleUsagewas already correct. - The