Skip to content

Fix DeepSeek v4 Claude pricing through stale runtime cache#367

Merged
iamtoruk merged 1 commit into
getagentseal:mainfrom
ozymandiashh:fix/deepseek-v4-claude-pricing
May 21, 2026
Merged

Fix DeepSeek v4 Claude pricing through stale runtime cache#367
iamtoruk merged 1 commit into
getagentseal:mainfrom
ozymandiashh:fix/deepseek-v4-claude-pricing

Conversation

@ozymandiashh
Copy link
Copy Markdown
Contributor

@ozymandiashh ozymandiashh commented May 20, 2026

Summary

Addresses #365 by pricing DeepSeek v4 Claude-compatible sessions instead of reporting them as $0.

Root cause

CodeBurn relies on LiteLLM pricing data, but deepseek-v4-pro and deepseek-v4-flash are not yet available in the bundled/runtime LiteLLM data used by current CodeBurn. A fresh 24-hour runtime pricing cache can also replace the bundled snapshot with data that still lacks these models, so adding snapshot entries alone is not enough.

What changed

  • Add temporary DeepSeek v4 manual pricing entries to the LiteLLM bundle until upstream LiteLLM includes them.
  • Merge bundled snapshot fallback entries into cached or freshly fetched LiteLLM pricing only when the runtime data lacks a model.
  • Add DeepSeek v4 display names for shared model reporting and the Claude provider.
  • Add an end-to-end CLI regression fixture for Claude JSONL sessions with a stale runtime pricing cache.

Validation

I ran the same Claude JSONL fixture against origin/main and this branch. The fixture contains two Claude-compatible assistant calls using the reported DeepSeek v4 model ids, plus a fresh runtime LiteLLM cache that does not contain those models.

Input shape:

provider: claude
model: deepseek-v4-pro
input_tokens: 2,477,914
output_tokens: 762,994
cache_read_input_tokens: 258,556,928

model: deepseek-v4-flash
input_tokens: 1,552,573
output_tokens: 353,914
cache_read_input_tokens: 48,388,608

Before, on origin/main, CodeBurn parsed the calls and tokens but priced both models at zero:

deepseek-v4-pro:   calls 1, cache reads 258,556,928, cost 0
deepseek-v4-flash: calls 1, cache reads 48,388,608, cost 0
TOTAL:             calls 2, cost 0

After, on this branch, the same input produces non-zero costs and the expected display names:

DeepSeek v4 Pro:   calls 1, cache reads 258,556,928, cost 2.678966
DeepSeek v4 Flash: calls 1, cache reads 48,388,608, cost 0.451944
TOTAL:             calls 2, cost 3.13091

That before/after path is now covered by tests/cli-deepseek-v4-pricing.test.ts, which runs the CLI against the realistic Claude fixture and stale runtime cache.

Notes

@ozymandiashh ozymandiashh marked this pull request as ready for review May 20, 2026 21:42
@iamtoruk iamtoruk merged commit 17eada2 into getagentseal:main May 21, 2026
3 checks passed
@iamtoruk
Copy link
Copy Markdown
Member

iamtoruk commented May 21, 2026

Hey @ozymandiashh I have just noticed that there was a similar PR but yours was better for next time, rather than having a duplicate PR if we can suggest changes on the existing PR, it would be better. :D

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.

2 participants