fix(billing): priority + long context 计费不再叠加倍率#4036
Open
fengshao1227 wants to merge 1 commit into
Open
Conversation
Contributor
|
是否有抓包说明 |
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.
背景
Fixes #4016
OpenAI 官方说明 priority processing 不支持 long context,请求会降级为 standard tier 计费。但 computeTokenBreakdown 先应用 priority 价格再叠加 long context 倍率,导致 gpt-5.6-sol 在超 272K input 时计费 $20/$90,正确应该是 $10/$45。
修改
billing_service.gocomputeTokenBreakdown:当 long context 触发且 service tier 是 priority 时,重置为标准价再应用 long context 倍率。兼容性
测试
更新了既有的 GPT-5.6 long context 测试(priority 的 longCtxExpected 从 2 改为 1),新增 TestBillingService_PriorityLongContextDoesNotStack 断言 priority+long context 费用等于 standard+long context。