Skip to content

[upstream-port][frontend][Opus 5.5] 定价页按 billing_mode/tiered_expr 正确分类按次计费(new-api #8010) #961

Closed

Description

@LIghtJUNction

上游

  • Commit: f1569d1ea7
  • PR: #8010 — fix(pricing): classify dynamic per-request billing correctly

改了什么 / 为什么要移植

上游定价侧栏/过滤器此前只看 quota_type 标量,导致 billing_mode === 'tiered_expr' 的动态表达式模型被误分到 token/按次类别(纯 fixed 叶子应为按次;混有 token 定价叶应归 token)。

上游改动(web/src/features/pricing/):

  1. 新增 getModelQuotaType(model):优先解析 billing_mode/billing_expr(compileBillingExpression + visitExpression),再回退 quota_type
  2. filterByQuotaType / 侧栏计数 / 价格排序改走 getModelQuotaType
  3. 补充 pricing-controls 测试;混合计费归为 token-based

fork 现状(tip wip/rust-core-go-extensions @ 81348495)

  • 已有类型字段:PricingModel.billing_mode / billing_expr(apps/web/src/features/pricing/types.ts)
  • 已有表达式编译:apps/web/src/features/pricing/lib/billing-expr.ts
  • 缺口:apps/web/src/features/pricing/lib/filters.ts 的 filterByQuotaType 仍直接 m.quota_type === targetType,没有 getModelQuotaType
  • 与 #911(按输入/输出/按次排序)不同主题,不重复

fork 映射路径

  • 上游 web/src/features/pricing/lib/filters.ts → apps/web/src/features/pricing/lib/filters.ts
  • 上游 web/src/features/pricing/components/pricing-sidebar.tsx → 对应侧栏计数(若 tip 有同组件)
  • 上游 __tests__/pricing-controls.test.tsx → tip 已有 filters.test.ts 等,补分类用例
  • 保持 LMM branding / docs/brand-design.md / NOTICE;勿改计费合约(1 USD=500000 credits)

风险

  • 过滤器误分类会影响用户发现/比价,不直接改后端扣费
  • compileBillingExpression 解析失败时必须回退 legacy quota_type,避免全过滤空
  • FE 必须用 CloudAgent claude-opus-5-5;当前 Cursor Opus 用量已知耗尽时本轮只开 issue,不启 agent

建议测试

  • tiered_expr + 全 fixed → REQUEST;含非 fixed tier 价 → TOKEN;无 billing_mode → 跟 quota_type
  • 侧栏 TOKEN/REQUEST 计数与列表一致;对照上游 pricing-controls 用例
  • apps/web 单测 + 手动点定价页分组过滤

工作量

小:约 0.5 天(helper + 过滤器/侧栏接线 + 测试)。需 Opus 5.5 FE agent;用量恢复后再启。


由 hourly maintenance bot 根据 upstream bc795cc1..34003e9c(本 commit 为其中 FE 项)生成。同窗口另 3 个后端 commit 已在 tip 判定 skip(见本次 actions)。

Activity

  1. added
    botOpened by the maintenance bot
    upstream-portQuantumNous/new-api upstream commit port candidate
    on Oct 25, 2026
  2. LIghtJUNction commented on Oct 28, 2026

    @LIghtJUNction
    MemberAuthor

    已合并:源码 PR #1,固定源码 27068288bf4d7733da3884b6b11023fb171ef476;配方 PR #967,相关配方 0.1.1。

    已重新核对当前源码,原 issue 所述旧 tip 的分类缺口已由现有 getModelQuotaType 与过滤器/侧栏接线覆盖:优先 billing_mode / tiered_expr,纯 fixed 叶子归按次,含 token 叶子的混合表达式归 token;嵌套结构、无效表达式及旧 quota_type 回退均有回归。无需重复移植旧 helper。

    本轮侧栏/分类定向用例 36 项通过;配合 #911 的排序与目录合同测试,完整 Web 类型检查通过。配方 0.1.1 已固定分类与回退要求。

    按“当前实现已具备且本轮验证”关闭。未运行真实浏览器独立验收,不改后端钱包或计费单位。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    botOpened by the maintenance botupstream-portQuantumNous/new-api upstream commit port candidate

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions