Skip to content

fix: 缓存账单收敛为仅按 DeepSeek-V4.1-Flash 计价与显示 - #7

Merged
better-er merged 2 commits into
mainfrom
fix/cache-billing-v4.1-flash
Sep 11, 2026
Merged

better-er merged 2 commits into
mainfrom
fix/cache-billing-v4.1-flash

Conversation

@better-er

Copy link
Copy Markdown
Owner

本 PR 把缓存账单的计价与显示收敛到 DeepSeek-V4.1-Flash 一个模型:价目表只留 Flash 一份,模型名识别覆盖官方现名与历史旧名,界面统一显示 DeepSeek-V4.1-Flash;未命中白名单的模型仍按 Flash 价估算,并标注实际运行模型。

背景

官方最新价格表里现行模型名为 deepseek-flash,对应 DeepSeek-V4.1-Flash;旧名 deepseek-v4-flash、deepseek-v4-flash-vision-exp 仍可调用,同样由 V4.1-Flash 提供服务。此前插件只认 deepseek-v4.1-flash 一个键,实际运行名带 expires-on 后缀时靠兜底匹配,切到官方新名后会走估算路径,显示也不统一。

具体改动

host 端 src/index.ts

  • 价目表由 PEAK_RATES / OFFPEAK_RATES 两张表加 FALLBACK_MODEL 收敛为单个 MODEL 常量,含规范名、显示名 DeepSeek-V4.1-Flash、别名白名单与峰谷两档费率。
  • 模型名匹配改为白名单三级匹配,精确、后缀、包含任一命中即可,rateOf 返回显示名与命中标记 matched。
  • wire view 新增 modelMatched 布尔;matchedModel 语义改为显示名。

client 端 src/client.ts

  • 命中白名单时底部小字显示「按 DeepSeek-V4.1-Flash 计价」;未命中时改为「估算 · 实际运行 <模型名>」,不再对同一个模型重复标注。

文档

  • README 同步单一模型计价与显示、白名单范围说明。

价格

价格未变,沿用官方最新表:低谷缓存命中 0.02 / 未命中输入 1 / 输出 4 元每百万 token,高峰翻倍。峰谷时段政策不变。

验证

  • pnpm run typecheck 通过,pnpm run build 通过。
  • 用构建产物实测模型名识别:
模型名 命中白名单 显示
deepseek-flash 是 DeepSeek-V4.1-Flash
deepseek-v4-flash 是 DeepSeek-V4.1-Flash
deepseek-v4-flash-vision-exp 是 DeepSeek-V4.1-Flash
deepseek-v4.1-flash 是 DeepSeek-V4.1-Flash
deepseek-v4.1-flash-expires-on-0910 是 DeepSeek-V4.1-Flash
deepseek-v4-pro 否 DeepSeek-V4.1-Flash 估算
  • 峰价 1M 未命中算出 2 元;谷价 1M 命中加 1M 输出算出 0.02 / 4 元,与价目表一致。

影响面

  • 只影响计价模型识别与底部标注文案,三块账单结构与金额算法不变。
  • 非 Flash 模型的估算行为保留,不会因价目表收敛而消失。
  • host 投影 state schema 未变,无需提升 stateVersion。

低谷价缓存命中 0.02、未命中输入 1、输出 4,高峰翻倍,删除 pro 与 vision-exp。
模型名支持后缀与包含匹配,deepseek-v4.1-flash-expires-on-0910 这类带后缀的实际 id 能命中;兜底不再固定峰价,改按当前时段取唯一模型价。
stateVersion 升到 6,旧持久化金额作废重放。
@better-er
better-er merged commit 381e3c3 into main Sep 11, 2026
1 check passed
@better-er
better-er deleted the fix/cache-billing-v4.1-flash branch September 11, 2026 12:58
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