mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-21 16:18:55 +00:00
feat(pricing): add deepseek-v4-flash to official-docs pricing snapshot
DeepSeek's /models endpoint returns no pricing, so direct-provider routes fall back to the _OFFICIAL_DOCS_PRICING snapshot. The table included deepseek-v4-pro but not the newer deepseek-v4-flash, so flash sessions reported $0.00 with cost_source "none". Add the flash entry (values from DeepSeek's official pricing page, mirroring the v4-pro entry; DeepSeek bills no separate cache-write cost) plus two regression tests. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
53adb3fd97
commit
97397a1ccc
2 changed files with 45 additions and 0 deletions
|
|
@ -477,6 +477,17 @@ _OFFICIAL_DOCS_PRICING: Dict[tuple[str, str], PricingEntry] = {
|
|||
source_url="https://api-docs.deepseek.com/quick_start/pricing",
|
||||
pricing_version="deepseek-pricing-2026-05-12",
|
||||
),
|
||||
(
|
||||
"deepseek",
|
||||
"deepseek-v4-flash",
|
||||
): PricingEntry(
|
||||
input_cost_per_million=Decimal("0.14"),
|
||||
output_cost_per_million=Decimal("0.28"),
|
||||
cache_read_cost_per_million=Decimal("0.0028"),
|
||||
source="official_docs_snapshot",
|
||||
source_url="https://api-docs.deepseek.com/quick_start/pricing",
|
||||
pricing_version="deepseek-pricing-2026-05-12",
|
||||
),
|
||||
# Google Gemini
|
||||
(
|
||||
"google",
|
||||
|
|
|
|||
|
|
@ -415,3 +415,37 @@ def test_fireworks_rows_all_carry_cache_read_pricing():
|
|||
entry = _OFFICIAL_DOCS_PRICING[key]
|
||||
assert entry.cache_read_cost_per_million is not None, key
|
||||
assert entry.cache_read_cost_per_million < entry.input_cost_per_million, key
|
||||
|
||||
|
||||
def test_deepseek_v4_flash_pricing_entry_exists():
|
||||
"""Regression test: deepseek-v4-flash must have a pricing entry.
|
||||
|
||||
Before this fix, deepseek-v4-flash sessions showed $0.00 / cost_source
|
||||
"none" because the _OFFICIAL_DOCS_PRICING table had an entry for
|
||||
deepseek-v4-pro but not the (newer) flash model. DeepSeek's /models
|
||||
endpoint returns no pricing, so the official-docs snapshot is the only
|
||||
source for direct-provider routes.
|
||||
"""
|
||||
entry = get_pricing_entry(
|
||||
"deepseek-v4-flash",
|
||||
provider="deepseek",
|
||||
)
|
||||
|
||||
assert entry is not None
|
||||
assert float(entry.input_cost_per_million) == 0.14
|
||||
assert float(entry.output_cost_per_million) == 0.28
|
||||
assert float(entry.cache_read_cost_per_million) == 0.0028
|
||||
|
||||
|
||||
def test_deepseek_v4_flash_estimate_usage_cost():
|
||||
"""Ensure deepseek-v4-flash sessions get a dollar estimate, not $0/none."""
|
||||
result = estimate_usage_cost(
|
||||
"deepseek-v4-flash",
|
||||
CanonicalUsage(input_tokens=1000000, output_tokens=500000),
|
||||
provider="deepseek",
|
||||
)
|
||||
|
||||
assert result.status == "estimated"
|
||||
assert result.amount_usd is not None
|
||||
# 1M input × $0.14/M + 500K output × $0.28/M = $0.14 + $0.14 = $0.28
|
||||
assert float(result.amount_usd) == 0.28
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue