Skip to content

feat(billing): 支持 Fast 档位与 max 推理强度 - #247

Merged
g1331 merged 2 commits into
masterfrom
feat/gpt-5-6-fast-billing
Aug 3, 2026
Merged

feat(billing): 支持 Fast 档位与 max 推理强度#247
g1331 merged 2 commits into
masterfrom
feat/gpt-5-6-fast-billing

Conversation

@g1331

@g1331 g1331 commented Aug 3, 2026

Copy link
Copy Markdown
Owner

Summary

补齐 GPT-5.6 max 推理强度、OpenAI Fast/Priority 处理档位和缓存写入 Token 的日志与计费支持。

Related Issue

无关联 Issue。

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactoring (code improvement without changing functionality)
  • Tests (adding or updating tests)
  • Build/CI (changes to build system or CI configuration)

Changes

  • max 纳入正式推理强度类型、请求日志和模型徽标。
  • 分别记录请求与上游实际 service_tier,展示 Fast、Fast → Standard 和 Fast 未确认状态。
  • 同步 LiteLLM Priority 单价,并按实际档位固化账单快照;未确认档位按 Standard 计费。
  • 提取 Chat Completions 与 Responses 的 cache_write_tokens,接入现有缓存写入计费。
  • 添加 PostgreSQL 与 SQLite 迁移及聚焦测试。

Test Plan

  • Local tests pass (pnpm test:run,3576 passed / 1 skipped)
  • Type check passes (pnpm exec tsc --noEmit)
  • Lint passes (pnpm lint)
  • Manual testing completed
  • Production build passes (pnpm build)
  • Drizzle artifacts are consistent (pnpm db:check:consistency)

Checklist

  • Code follows the project's coding standards
  • Tests have been added where necessary
  • Documentation has been updated (if applicable)
  • Changes do not introduce security vulnerabilities
  • Commit messages follow conventions

Screenshots

未提供。日志状态徽标已通过组件测试覆盖,尚未使用包含真实 Fast 响应的本地数据进行人工截图。

Additional Notes

  • 请求 Fast 但上游未返回档位时,记录为 unknown 并按 Standard 计费。
  • 上游确认 Fast、但目录缺少 Priority 输入或输出单价时,记录为 price_not_found,不会静默套用 Standard 单价。
  • 生产构建存在仓库原有的 Turbopack NFT 动态路径警告,与本次变更无关。

@codecov

codecov Bot commented Aug 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 87.95181% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.24%. Comparing base (c18bb44) to head (fbaa9e6).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #247      +/-   ##
==========================================
+ Coverage   72.13%   72.24%   +0.10%     
==========================================
  Files         243      243              
  Lines       14152    14228      +76     
  Branches     4676     4716      +40     
==========================================
+ Hits        10209    10279      +70     
  Misses       2598     2598              
- Partials     1345     1351       +6     
Flag Coverage Δ
verify 72.24% <87.95%> (+0.10%) ⬆️
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@g1331

g1331 commented Aug 3, 2026

Copy link
Copy Markdown
Owner Author

独立复审后补充提交 fbaa9e62

  • 保留手工价格的权威优先级;已确认 Fast 命中 LiteLLM Standard-only 阶梯规则时,优先尝试手工平价覆盖,否则记为 price_not_found
  • 在限流、模型拒绝、模型规则排除、普通失败、断流、流式失败与过期对账路径中保留 requestedServiceTier;没有成功响应证据时 effectiveServiceTier 保持 null
  • 补强 Responses reasoning.effort: max 与上述组合的回归测试。

本地验证:3579 tests passed / 1 skipped;Lint、Prettier、TypeScript、production build 均通过。

@g1331
g1331 merged commit 98fa986 into master Aug 3, 2026
12 checks passed
@g1331
g1331 deleted the feat/gpt-5-6-fast-billing branch August 3, 2026 09:03
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.

1 participant