-
-
Notifications
You must be signed in to change notification settings - Fork 376
fix: 支持 Gemini thoughtsTokenCount 计费 #326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1206,6 +1206,11 @@ function extractUsageMetrics(value: unknown): UsageMetrics | null { | |
| result.cache_read_input_tokens = usage.cachedContentTokenCount; | ||
| hasAny = true; | ||
| } | ||
| // Gemini 思考/推理 token:直接累加到 output_tokens(思考价格与输出价格相同) | ||
| if (typeof usage.thoughtsTokenCount === "number" && usage.thoughtsTokenCount > 0) { | ||
| result.output_tokens = (result.output_tokens ?? 0) + usage.thoughtsTokenCount; | ||
| hasAny = true; | ||
| } | ||
|
Comment on lines
+1210
to
+1213
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这里存在一个严重的计费逻辑错误。当前代码在将 为了修复此问题,建议将这个 |
||
|
|
||
| if (typeof usage.output_tokens === "number") { | ||
| result.output_tokens = usage.output_tokens; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
变更日志的内容与本次合并请求的修改不匹配。本次修改的核心是支持 Gemini 的
thoughtsTokenCount计费,但 v0.3.28版本的日志条目描述的是其他功能(#314, #313)。请更新此部分,以准确反映本次 PR 的实际贡献。