Incorrect total cost display in TUI: shows much higher amount than actual DeepSeek platform consumption (possible saved/cache hit calculation bug)
Bug Description
The total cost displayed in the codewhale-tui interface is significantly higher than the actual consumption shown on the DeepSeek Open Platform dashboard.
Steps to Reproduce
- Use the latest Windows version of CodeWhale
- Run
codewhale-tuiand check the total cost displayed in the status bar - Compare this value with the "Monthly Consumption" figure on the DeepSeek Open Platform console
Actual Behavior
- CodeWhale TUI status bar shows: ¥53.90 (as shown in the first screenshot)
- DeepSeek Open Platform actual monthly consumption: ¥15.13 (as shown in the second screenshot)
- There is a discrepancy of over 3.5x between the two values
Expected Behavior
The total cost displayed in the TUI should accurately match the actual consumption billed by DeepSeek.
Additional Context
I noticed that the latest update appears to have added a "saved" indicator in the status bar (partially visible in the first screenshot). I suspect this issue may be related to the calculation of cache hit savings:
- It seems the TUI might be incorrectly calculating the total cost by not properly accounting for the discounted pricing of cached tokens
- Or alternatively, the "saved" amount is being added to the total cost instead of subtracted from it
- The cache hit feature on DeepSeek charges significantly less for repeated tokens, which may not be correctly reflected in CodeWhale's internal cost calculation
Screenshots
- CodeWhale TUI status bar showing incorrect total cost:
- DeepSeek Open Platform dashboard showing actual monthly consumption:
Environment
- OS: Windows
- CodeWhale version: latest (as of June 2, 2026)
- Model: DeepSeek V4
Thanks @caiyilian for the screenshots and for calling out the cache-hit angle. I checked this against the v0.8.50 branch and the current DeepSeek pricing page. The cost calculator is already using the current V4-Pro rates after the 2026-05-31 cutoff, including separate cache-hit/cache-miss input prices, so this does not look like the old #2489 4x pricing-table bug in the current branch.
One thing your screenshot likely exposed is a footer-legibility issue: the optional account-balance chip was labeled bal, and on narrow footers the balance chip can remain visible while session cost is dropped. That can make remaining account balance look like total spend. I harvested that into #2504: the English chip now says balance ¥... instead of bal ¥... so it is harder to confuse with session spend.
I am leaving this open until we confirm the actual installed version and which footer chip was visible. Could you please retest with the next build and share:
codewhale-tui --version- whether the footer text says
balance,cost, or both /cost,/tokens, and/cacheoutput after one short V4-Pro turn
If /cost itself still differs from the platform usage on v0.8.50, we should treat that as a real remaining accounting bug rather than a display-label issue.
Thanks again @caiyilian. I traced the inflated cost display to a cache-telemetry mixing case and opened #2630 for v0.8.52. The fix keeps DeepSeek prompt_cache_hit_tokens and OpenAI-style cached_tokens accounting from being combined inconsistently, which is the path that could overstate cached input cost.
The cache-accounting fix from #2630 is now merged to main and will be part of v0.8.52. Sorry this took a messy path through the release work; the concrete fix is to keep the selected cache-hit telemetry source consistent when deriving cache-miss tokens, which should avoid overstating cached input cost. I am leaving this open until v0.8.52 is published and you can retest against the same DeepSeek dashboard comparison.
@Hmbown Thanks so much for tracking down the actual root cause and fixing it quickly.