mirror of
https://github.com/pacnpal/Roo-Code.git
synced 2025-12-20 12:21:13 -05:00
Use openrouter generation endpoint for usage reporting
This commit is contained in:
@@ -107,13 +107,13 @@ export class OpenRouterHandler implements ApiHandler {
|
|||||||
text: delta.content,
|
text: delta.content,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (chunk.usage) {
|
// if (chunk.usage) {
|
||||||
yield {
|
// yield {
|
||||||
type: "usage",
|
// type: "usage",
|
||||||
inputTokens: chunk.usage.prompt_tokens || 0,
|
// inputTokens: chunk.usage.prompt_tokens || 0,
|
||||||
outputTokens: chunk.usage.completion_tokens || 0,
|
// outputTokens: chunk.usage.completion_tokens || 0,
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -130,11 +130,9 @@ export class OpenRouterHandler implements ApiHandler {
|
|||||||
type: "usage",
|
type: "usage",
|
||||||
// cacheWriteTokens: 0,
|
// cacheWriteTokens: 0,
|
||||||
// cacheReadTokens: 0,
|
// cacheReadTokens: 0,
|
||||||
// openrouter generation endpoint fails often, so we'll report tokens from stream as normal
|
// openrouter generation endpoint fails often
|
||||||
// inputTokens: generation?.native_tokens_prompt || 0,
|
inputTokens: generation?.native_tokens_prompt || 0,
|
||||||
// outputTokens: generation?.native_tokens_completion || 0,
|
outputTokens: generation?.native_tokens_completion || 0,
|
||||||
inputTokens: 0,
|
|
||||||
outputTokens: 0,
|
|
||||||
totalCost: generation?.total_cost || 0,
|
totalCost: generation?.total_cost || 0,
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user