mirror of
https://github.com/pacnpal/Roo-Code.git
synced 2025-12-20 12:21:13 -05:00
Fixing anthropic model caching in roo-code
This commit is contained in:
committed by
Vignesh Subbiah
parent
117c4abfee
commit
26369ca48b
@@ -106,10 +106,20 @@ export class UnboundHandler implements ApiHandler, SingleCompletionHandler {
|
||||
}
|
||||
|
||||
if (usage) {
|
||||
yield {
|
||||
type: "usage",
|
||||
inputTokens: usage?.prompt_tokens || 0,
|
||||
outputTokens: usage?.completion_tokens || 0,
|
||||
if (this.getModel().id.startsWith("anthropic/")) {
|
||||
yield {
|
||||
type: "usage",
|
||||
inputTokens: usage?.prompt_tokens || 0,
|
||||
outputTokens: usage?.completion_tokens || 0,
|
||||
cacheWriteTokens: (usage as any)?.cache_creation_input_tokens || 0,
|
||||
cacheReadTokens: (usage as any)?.cache_read_input_tokens || 0,
|
||||
}
|
||||
} else {
|
||||
yield {
|
||||
type: "usage",
|
||||
inputTokens: usage?.prompt_tokens || 0,
|
||||
outputTokens: usage?.completion_tokens || 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user