Repository navigation
fix(plugins): 按 Vertex 上报 Token 结算 Gemini Omni 用量 - #224
Merged
Merged
Conversation
This was referenced Nov 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🔗 关联任务 / Related Issue
Closes #221
基于上游 QuantumNous/new-api@c046559(QuantumNous#8153),保留 fork 既有计费行为。
🚀 变更类型 / Type of change
📝 变更描述 / Description
Gemini Omni 表达式使用 Vertex 上报的输入、文本(含 thinking)、视频(含音频)Token 事实。原有
seconds、resolution、generate_audioschema 和真实请求事实继续可用,已有时长表达式按原价执行,不迁移或重写管理员价格。通过既有
usagePurpose边界区分表达式事实和旧倍率:billing_ratios返回基线时长事实,Token 数不再成为旧价格的额外乘数。完成回包逐项验证非负整数后才累加;缺失事实保留预留,非法数量或聚合溢出使完成覆盖无效,显式数值零有效,正常大数仍由宿主饱和。独立审查 F1/F2 的修复保留,F3 已补充修复及实际宿主回归;仍须新的独立 Astra medium 审查后才能合入。本 PR 为 Codex AI 辅助工作,等待维护者审阅。仅两个授权文件;不涉及 OAuth、数据库、依赖或部署,不关闭 #21、#51、#65、#83。
📸 运行证明 / Proof of Work
以下命令均使用
GOMAXPROCS=2 RAYON_NUM_THREADS=2 GOPROXY=off:go test -p=2 ./plugins -run '^TestVertexAIOmniLegacyBillingRatios$' -count=1 -v:按预期失败;两个 Omni 名称的EstimateBillingValidated均返回{seconds:8, video_tokens:15448},期望仅{seconds:8}。go test -p=2 ./plugins -run '^TestVertexAI' -count=1 -v:PASS,9 个顶层测试。旧倍率恢复仅seconds=8,表达式事实仍含video_tokens=15448;已有旧/新价格、20 个完成用量场景及其他 Vertex 回归全部通过。git diff --check:通过。F3 修复仅增加用途分支和一个实际插件/宿主回归;F1 验证、F2 schema/事实与元数据标签未变。✅ 提交前检查项 / Checklist