mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-10-06 02:47:56 +00:00
Fixing anthropic model caching in roo-code
This commit is contained in:
parent
117c4abfee
commit
26369ca48b
1 changed files with 14 additions and 4 deletions
|
|
@ -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,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue