Drop the retired top-up bonus from displayed model prices - #691
Merged
Conversation
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.
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.
问题
flatkey.ai/zh/models上gpt-4.1-mini显示$0.4→$0.24,即官方价的 6 折。但充值赠送活动已经取消,这个折扣不该存在。证据
线上
/api/website/pricing?group=plg实测:该 payload 只带一个分组倍率 plg = 0.9,
gpt-4.1-mini的model_ratio = 0.2。正确价格应为
0.2 × 2 × 0.9 = $0.36。多出来的0.24 / 0.36 = 2/3来自别处。根因
website/src/lib/pricing.ts:281硬编码的
× 2/3是「充 $200 送 $100」等效单价(200/300 = 2/3)。赠送取消后这一层失效,但代码仍在乘,导致页面宣传一个已不存在的折扣。调用链:
ModelsPage→getPricingData("plg")→PricingExplorer→buildRowsForModels→discountedPriceUsd。改动
discountedPriceUsd改为原值返回。分组倍率(调用方经getBestGroupRatio施加)成为唯一折扣层,/models展示的即 plg 用户实付价。gpt-4.1-mini:$0.24→$0.36。顺带更新
home-models.ts、models-directory-table.tsx里描述赠送层的注释;修正home-page.test.ts—— 它断言的是旧的叠加数值。范围
按需求只处理
/models。刻意未动的部分:/models/[slug]调getPricingData()(不带 group),其 payload 的group_ratio是完整分组表(Economy0.6、Standard0.8、GPT Official0.9…),没有 plg 键。要对齐 plg 需改数据源,是独立决策。这两处本次只是同样去掉了× 2/3。pricing-page.tsx的bonus10/20/200Caption、「up to 50% off」、home-copy.ts8 语言描述)全部保留 —— 这些在/models上都不渲染,改动需配套 8 语言翻译。验证
home-models-plg-pricing.test.ts)覆盖 plg 定价、无倍率兜底、按次计费后缀next/server模块缺失的环境问题,已 stash 对照验证基线 main 同样 26 个(基线 110 pass,本 PR 114 pass,多的 4 个即新增用例)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/models上gpt-4.1-mini显示$0.36。