mirror of
https://github.com/pacnpal/Roo-Code.git
synced 2025-12-20 12:21:13 -05:00
Add prompt caching to openrouter; remove o1 since it doesn't support tool use
This commit is contained in:
@@ -1656,6 +1656,9 @@ ${this.customInstructions.trim()}
|
||||
let cacheReadInputTokens =
|
||||
(response as Anthropic.Beta.PromptCaching.Messages.PromptCachingBetaMessage).usage
|
||||
.cache_read_input_tokens || undefined
|
||||
// @ts-ignore-next-line
|
||||
let totalCost = response.usage.total_cost
|
||||
|
||||
await this.say(
|
||||
"api_req_finished",
|
||||
JSON.stringify({
|
||||
@@ -1663,12 +1666,14 @@ ${this.customInstructions.trim()}
|
||||
tokensOut: outputTokens,
|
||||
cacheWrites: cacheCreationInputTokens,
|
||||
cacheReads: cacheReadInputTokens,
|
||||
cost: this.calculateApiCost(
|
||||
inputTokens,
|
||||
outputTokens,
|
||||
cacheCreationInputTokens,
|
||||
cacheReadInputTokens
|
||||
),
|
||||
cost:
|
||||
totalCost ||
|
||||
this.calculateApiCost(
|
||||
inputTokens,
|
||||
outputTokens,
|
||||
cacheCreationInputTokens,
|
||||
cacheReadInputTokens
|
||||
),
|
||||
})
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user