Skip to content

Drop the retired top-up bonus from displayed model prices - #691

Merged
think-back merged 1 commit into
mainfrom
fix/pricing-plg-discount
Aug 11, 2026
Merged

Drop the retired top-up bonus from displayed model prices#691
think-back merged 1 commit into
mainfrom
fix/pricing-plg-discount

Conversation

@think-back

Copy link
Copy Markdown
Collaborator

问题

flatkey.ai/zh/modelsgpt-4.1-mini 显示 $0.4$0.24,即官方价的 6 折。但充值赠送活动已经取消,这个折扣不该存在。

证据

线上 /api/website/pricing?group=plg 实测:

"group_ratio": {"plg": 0.9}
"usable_group": {"plg": "plg"}

该 payload 只带一个分组倍率 plg = 0.9,gpt-4.1-minimodel_ratio = 0.2

正确价格应为 0.2 × 2 × 0.9 = $0.36。多出来的 0.24 / 0.36 = 2/3 来自别处。

根因

website/src/lib/pricing.ts:281

// Effective price after the best top-up bonus tier ($200 + $100 → 2/3 of list).
export function discountedPriceUsd(value: number): number {
  return (value * 2) / 3;
}

硬编码的 × 2/3 是「充 $200 送 $100」等效单价(200/300 = 2/3)。赠送取消后这一层失效,但代码仍在乘,导致页面宣传一个已不存在的折扣。

调用链:ModelsPagegetPricingData("plg")PricingExplorerbuildRowsForModelsdiscountedPriceUsd

改动

discountedPriceUsd 改为原值返回。分组倍率(调用方经 getBestGroupRatio 施加)成为唯一折扣层,/models 展示的即 plg 用户实付价。

gpt-4.1-mini$0.24$0.36

顺带更新 home-models.tsmodels-directory-table.tsx 里描述赠送层的注释;修正 home-page.test.ts —— 它断言的是旧的叠加数值。

范围

按需求只处理 /models。刻意未动的部分:

  • 首页、/models/[slug]getPricingData()(不带 group),其 payload 的 group_ratio 是完整分组表(Economy 0.6、Standard 0.8、GPT Official 0.9…),没有 plg 键。要对齐 plg 需改数据源,是独立决策。这两处本次只是同样去掉了 × 2/3
  • 赠送文案(首页 hero「官方 ⅔ / after bonus」、pricing-page.tsxbonus10/20/200Caption、「up to 50% off」、home-copy.ts 8 语言描述)全部保留 —— 这些在 /models 上都不渲染,改动需配套 8 语言翻译。

⚠️ 这两项意味着首页仍在展示赠送信息,建议后续跟进。

验证

bun test        114 pass / 26 fail
bun run typecheck   通过
bun run lint        1 error
  • 新增 4 个测试(home-models-plg-pricing.test.ts)覆盖 plg 定价、无倍率兜底、按次计费后缀
  • 26 个测试失败是 next/server 模块缺失的环境问题,已 stash 对照验证基线 main 同样 26 个(基线 110 pass,本 PR 114 pass,多的 4 个即新增用例)
  • lint 的 1 个 error 在 cli-prompt-action-panel.tsx,本 PR 未触碰该文件,为 main 既有问题

部署

  • Router deploy: not required —— 改动仅限 website/,不涉及 /v1、relay、计费结算、中间件或共享 Go 运行时。实际扣费逻辑在 relay/helper/price.go,本 PR 未触及,仅影响展示
  • Other deploy targets: newapi-web(Cloud Run,gcp-deploy-website.yml,仅 website/** 变更触发)。
  • Risk / validation: 面向公众的价格数字上调(6 折 → 9 折),属修正而非涨价——实际计费从未打过 6 折。上线后核对 /zh/modelsgpt-4.1-mini 显示 $0.36

The $200+$100 top-up bonus is no longer offered, but discountedPriceUsd
still multiplied every displayed price by 2/3, so the pricing pages
advertised a discount that no longer exists.

On /models this produced $0.24 for gpt-4.1-mini against a $0.40 official
price — 60% of list. That page fetches /api/website/pricing?group=plg,
whose payload carries exactly one group ratio (plg = 0.9), so the correct
figure is $0.36. The extra 2/3 came purely from the retired bonus.

discountedPriceUsd now passes the value through unchanged. The group
ratio, applied by callers via getBestGroupRatio, becomes the only
discount layer, so /models shows the price a plg user actually pays.

Comments in home-models.ts and models-directory-table.tsx that described
the bonus layer are updated, and home-page.test.ts is corrected — it
asserted the old stacked figures.

Scope note: the homepage and /models/[slug] call getPricingData() without
a group, whose payload has no plg key, so their getBestGroupRatio still
resolves against the full group table. Aligning those to plg needs a data
source change and is deliberately left out. Bonus copy on the homepage
and /pricing (bonus10/20/200 captions, "up to 50% off") is likewise
untouched — none of it renders on /models.
@think-back
think-back merged commit 7098676 into main Aug 11, 2026
1 check passed
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