修复 DeepSeek 计费价格与新会话花费重置#978
Merged
Merged
Conversation
652dce3 to
c5a69f0
Compare
Contributor
Author
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.
概要
prompt_cache_miss_tokens时,用prompt_tokens - prompt_cache_hit_tokens兜底,避免漏算未命中输入/new新建对话时同步重置 loop 统计和状态栏花费,避免新会话继承旧的“本会话已花费”原因
当前官方价格页显示:
deepseek-v4-flash: cache hit input $0.0028 / 1M tokens,cache miss input $0.14 / 1M tokens,output $0.28 / 1M tokensdeepseek-v4-pro: 当前优惠期 cache hit input $0.003625 / 1M tokens,cache miss input $0.435 / 1M tokens,output $0.87 / 1M tokens旧表中 flash 兼容模型的 cache hit input 被高估了 10 倍,v4-pro 也还是旧的更高价格。另外
/new只清聊天记录,没有清SessionStats和 UI 状态栏计数,所以新对话里“本会话已花费”可能继续沿用旧累计。参考:https://api-docs.deepseek.com/quick_start/pricing/
验证
npm run lintnpm run typechecknpm run buildnpm test -- --runnpm run verify