Skip to content

fix(billing): restore GPT-5.6 long-context pricing - #284

Merged
xunyoyo merged 3 commits into
mainfrom
codex/fix-gpt56-long-context
Jul 12, 2026
Merged

fix(billing): restore GPT-5.6 long-context pricing#284
xunyoyo merged 3 commits into
mainfrom
codex/fix-gpt56-long-context

Conversation

@xunyoyo

@xunyoyo xunyoyo commented Jul 12, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • restore OpenAI GPT-5.6 pricing for requests whose input context exceeds 272K: input-side (including cache read/write) 2x and output 1.5x
  • preserve explicit *_above_272k_tokens catalog and channel interval prices instead of clearing or clipping them
  • add regression coverage for 272K boundary and 328,375-token cache-read request ($0.338689)

Scope

Forward-only billing behavior. No historical usage records are adjusted.

Verification

  • go test ./internal/service -count=1
  • go vet ./internal/service
  • go test ./... -count=1
  • go test -tags integration ./internal/repository/... -count=1

@xunyoyo
xunyoyo force-pushed the codex/fix-gpt56-long-context branch from 6f3cb01 to df5da67 Compare July 12, 2026 03:37
@smallbearrr

smallbearrr commented Jul 12, 2026

Copy link
Copy Markdown

审查发现一个需要修复的问题:

  • backend/internal/service/billing_service.go 的 LiteLLM -> ModelPricing 转换路径只传入 base price 和 long-context multiplier,没有把 InputCostPerTokenAbove272KTokens / OutputCostPerTokenAbove272KTokens / cache read/write 的 *_above_272k_tokens 显式高档价格带入实际计费。与此同时,本 PR 的文档和展示层都在保留/展示这些显式 272K+ 价格。

影响:如果远程目录或渠道配置里的显式高档价格不等于 base * 2 / base * 1.5,客户实际扣费会和价格展示/文档描述不一致,可能过扣或少扣。

建议:实际计费路径也应优先使用显式 above-272K 价格,或在转换到 ModelPricing 时把这些高档价格表达出来;同时补一个显式 above-272K 价格故意不等于 multiplier 结果的回归测试,覆盖 input/output/cache read/cache write。

@codecov

codecov Bot commented Jul 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@xunyoyo
xunyoyo marked this pull request as ready for review July 12, 2026 15:19
@xunyoyo
xunyoyo merged commit 0280d23 into main Jul 12, 2026
15 checks passed
@xunyoyo
xunyoyo deleted the codex/fix-gpt56-long-context branch July 18, 2026 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants