fix(model_prices): add cache-read pricing to Mistral chat models missing it

Mistral bills cached prompt tokens at 10% of the input price for every model, but twelve
active mistral/ chat rows had no cache_read_input_token_cost, so the cost calculator billed
their cache hits at zero. Adds the derived rate to those rows in both registry copies and a
registry invariant test that fails when an active priced Mistral chat row drops the field or
drifts from the 10% ratio

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
kerry 2026-09-18 02:13:44 +00:00
parent 34718f0da6
commit 6933ca2337
3 changed files with 52 additions and 0 deletions

View file

@ -36785,6 +36785,7 @@
"supports_tool_choice": true
},
"mistral/codestral-mamba-latest": {
"cache_read_input_token_cost": 2.5e-08,
"input_cost_per_token": 2.5e-07,
"litellm_provider": "mistral",
"max_input_tokens": 256000,
@ -36842,6 +36843,7 @@
"supports_tool_choice": true
},
"mistral/devstral-small-latest": {
"cache_read_input_token_cost": 1e-08,
"input_cost_per_token": 1e-07,
"litellm_provider": "mistral",
"max_input_tokens": 256000,
@ -36871,6 +36873,7 @@
"supports_tool_choice": true
},
"mistral/devstral-latest": {
"cache_read_input_token_cost": 4e-08,
"input_cost_per_token": 4e-07,
"litellm_provider": "mistral",
"max_input_tokens": 256000,
@ -36885,6 +36888,7 @@
"supports_tool_choice": true
},
"mistral/devstral-medium-latest": {
"cache_read_input_token_cost": 4e-08,
"input_cost_per_token": 4e-07,
"litellm_provider": "mistral",
"max_input_tokens": 256000,
@ -36986,6 +36990,7 @@
"source": "https://docs.mistral.ai/models/mistral-embed-23-12"
},
"mistral/mistral-medium-3": {
"cache_read_input_token_cost": 1.5e-07,
"input_cost_per_token": 1.5e-06,
"litellm_provider": "mistral",
"max_input_tokens": 262144,
@ -37034,6 +37039,7 @@
"supports_audio_output": true
},
"mistral/voxtral-small-2507": {
"cache_read_input_token_cost": 1e-08,
"input_cost_per_second": 6.666666666666667e-05,
"input_cost_per_token": 1e-07,
"litellm_provider": "mistral",
@ -37049,6 +37055,7 @@
"supports_tool_choice": true
},
"mistral/voxtral-small-latest": {
"cache_read_input_token_cost": 1e-08,
"input_cost_per_second": 6.666666666666667e-05,
"input_cost_per_token": 1e-07,
"litellm_provider": "mistral",
@ -37554,6 +37561,7 @@
"supports_vision": true
},
"mistral/mistral-small": {
"cache_read_input_token_cost": 1e-08,
"input_cost_per_token": 1e-07,
"litellm_provider": "mistral",
"max_input_tokens": 32000,
@ -37680,6 +37688,7 @@
"supports_vision": true
},
"mistral/mistral-tiny": {
"cache_read_input_token_cost": 2.5e-08,
"input_cost_per_token": 2.5e-07,
"litellm_provider": "mistral",
"max_input_tokens": 32000,
@ -37718,6 +37727,7 @@
"supports_tool_choice": true
},
"mistral/open-mistral-nemo": {
"cache_read_input_token_cost": 3e-08,
"input_cost_per_token": 3e-07,
"litellm_provider": "mistral",
"max_input_tokens": 128000,
@ -37803,6 +37813,7 @@
"supports_vision": true
},
"mistral/pixtral-large-latest": {
"cache_read_input_token_cost": 2e-07,
"input_cost_per_token": 2e-06,
"litellm_provider": "mistral",
"max_input_tokens": 128000,
@ -62790,6 +62801,7 @@
"supports_tool_choice": true
},
"mistral/mistral-code-agent-latest": {
"cache_read_input_token_cost": 4e-08,
"input_cost_per_token": 4e-07,
"litellm_provider": "mistral",
"max_input_tokens": 256000,

View file

@ -36785,6 +36785,7 @@
"supports_tool_choice": true
},
"mistral/codestral-mamba-latest": {
"cache_read_input_token_cost": 2.5e-08,
"input_cost_per_token": 2.5e-07,
"litellm_provider": "mistral",
"max_input_tokens": 256000,
@ -36842,6 +36843,7 @@
"supports_tool_choice": true
},
"mistral/devstral-small-latest": {
"cache_read_input_token_cost": 1e-08,
"input_cost_per_token": 1e-07,
"litellm_provider": "mistral",
"max_input_tokens": 256000,
@ -36871,6 +36873,7 @@
"supports_tool_choice": true
},
"mistral/devstral-latest": {
"cache_read_input_token_cost": 4e-08,
"input_cost_per_token": 4e-07,
"litellm_provider": "mistral",
"max_input_tokens": 256000,
@ -36885,6 +36888,7 @@
"supports_tool_choice": true
},
"mistral/devstral-medium-latest": {
"cache_read_input_token_cost": 4e-08,
"input_cost_per_token": 4e-07,
"litellm_provider": "mistral",
"max_input_tokens": 256000,
@ -36986,6 +36990,7 @@
"source": "https://docs.mistral.ai/models/mistral-embed-23-12"
},
"mistral/mistral-medium-3": {
"cache_read_input_token_cost": 1.5e-07,
"input_cost_per_token": 1.5e-06,
"litellm_provider": "mistral",
"max_input_tokens": 262144,
@ -37034,6 +37039,7 @@
"supports_audio_output": true
},
"mistral/voxtral-small-2507": {
"cache_read_input_token_cost": 1e-08,
"input_cost_per_second": 6.666666666666667e-05,
"input_cost_per_token": 1e-07,
"litellm_provider": "mistral",
@ -37049,6 +37055,7 @@
"supports_tool_choice": true
},
"mistral/voxtral-small-latest": {
"cache_read_input_token_cost": 1e-08,
"input_cost_per_second": 6.666666666666667e-05,
"input_cost_per_token": 1e-07,
"litellm_provider": "mistral",
@ -37554,6 +37561,7 @@
"supports_vision": true
},
"mistral/mistral-small": {
"cache_read_input_token_cost": 1e-08,
"input_cost_per_token": 1e-07,
"litellm_provider": "mistral",
"max_input_tokens": 32000,
@ -37680,6 +37688,7 @@
"supports_vision": true
},
"mistral/mistral-tiny": {
"cache_read_input_token_cost": 2.5e-08,
"input_cost_per_token": 2.5e-07,
"litellm_provider": "mistral",
"max_input_tokens": 32000,
@ -37718,6 +37727,7 @@
"supports_tool_choice": true
},
"mistral/open-mistral-nemo": {
"cache_read_input_token_cost": 3e-08,
"input_cost_per_token": 3e-07,
"litellm_provider": "mistral",
"max_input_tokens": 128000,
@ -37803,6 +37813,7 @@
"supports_vision": true
},
"mistral/pixtral-large-latest": {
"cache_read_input_token_cost": 2e-07,
"input_cost_per_token": 2e-06,
"litellm_provider": "mistral",
"max_input_tokens": 128000,
@ -62790,6 +62801,7 @@
"supports_tool_choice": true
},
"mistral/mistral-code-agent-latest": {
"cache_read_input_token_cost": 4e-08,
"input_cost_per_token": 4e-07,
"litellm_provider": "mistral",
"max_input_tokens": 256000,

View file

@ -274,3 +274,31 @@ def test_every_bedrock_openai_gpt_row_advertises_xhigh(prices: dict):
and "xhigh" not in (resolve_supported_reasoning_efforts(entry, deployment_is_mapped=True) or ())
]
assert missing == []
def is_active_priced_mistral_chat_row(name: str, entry: dict) -> bool:
return (
name.startswith("mistral/")
and entry.get("mode") == "chat"
and entry.get("deprecation_date") is None
and (entry.get("input_cost_per_token") or 0) > 0
)
def test_active_mistral_chat_rows_price_cache_reads_below_input(prices: dict):
"""A Mistral chat row without a cache-read rate bills cached prompt tokens at zero, so every
active priced row must carry one, and it must be cheaper than a fresh input token. Mistral
bills cached tokens at 10% of the input price for every model (docs.mistral.ai/studio/
conversations/advanced/prompt-caching, read 2026-09-18), so the ratio is checked as well."""
drifted: Final = [
f"{name}: cache_read={entry.get('cache_read_input_token_cost')} input={entry['input_cost_per_token']}"
for name, entry in prices.items()
if isinstance(entry, dict)
and is_active_priced_mistral_chat_row(name, entry)
and not (
isinstance(entry.get("cache_read_input_token_cost"), float)
and 0 < entry["cache_read_input_token_cost"] < entry["input_cost_per_token"]
and entry["cache_read_input_token_cost"] == pytest.approx(entry["input_cost_per_token"] / 10)
)
]
assert drifted == []