mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-29 06:33:28 +00:00
feat(mistral): add zai-glm-5-3-flash to the cost map (#48270)
Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
2e52e0fb2a
commit
de5dc5b238
3 changed files with 50 additions and 11 deletions
|
|
@ -42726,6 +42726,29 @@
|
|||
"supports_response_schema": true,
|
||||
"supports_tool_choice": true
|
||||
},
|
||||
"mistral/zai-glm-5-3-flash": {
|
||||
"cache_read_input_token_cost": 3e-08,
|
||||
"input_cost_per_token": 1.5e-07,
|
||||
"litellm_provider": "mistral",
|
||||
"max_input_tokens": 1048576,
|
||||
"max_output_tokens": 131072,
|
||||
"max_tokens": 131072,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 5e-07,
|
||||
"reasoning_effort_levels": [
|
||||
"low",
|
||||
"high",
|
||||
"max"
|
||||
],
|
||||
"source": "https://docs.mistral.ai/models/zai-glm-5-3-flash",
|
||||
"supports_assistant_prefill": true,
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_response_schema": true,
|
||||
"supports_tool_choice": true,
|
||||
"supports_vision": true
|
||||
},
|
||||
"mistral/zai-glm-5": {
|
||||
"cache_read_input_token_cost": 1.4e-07,
|
||||
"input_cost_per_token": 1.4e-06,
|
||||
|
|
|
|||
|
|
@ -42726,6 +42726,29 @@
|
|||
"supports_response_schema": true,
|
||||
"supports_tool_choice": true
|
||||
},
|
||||
"mistral/zai-glm-5-3-flash": {
|
||||
"cache_read_input_token_cost": 3e-08,
|
||||
"input_cost_per_token": 1.5e-07,
|
||||
"litellm_provider": "mistral",
|
||||
"max_input_tokens": 1048576,
|
||||
"max_output_tokens": 131072,
|
||||
"max_tokens": 131072,
|
||||
"mode": "chat",
|
||||
"output_cost_per_token": 5e-07,
|
||||
"reasoning_effort_levels": [
|
||||
"low",
|
||||
"high",
|
||||
"max"
|
||||
],
|
||||
"source": "https://docs.mistral.ai/models/zai-glm-5-3-flash",
|
||||
"supports_assistant_prefill": true,
|
||||
"supports_function_calling": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_response_schema": true,
|
||||
"supports_tool_choice": true,
|
||||
"supports_vision": true
|
||||
},
|
||||
"mistral/zai-glm-5": {
|
||||
"cache_read_input_token_cost": 1.4e-07,
|
||||
"input_cost_per_token": 1.4e-06,
|
||||
|
|
|
|||
|
|
@ -455,30 +455,23 @@ def is_active_priced_mistral_chat_row(name: str, entry: Mapping[str, object]) ->
|
|||
)
|
||||
|
||||
|
||||
def cache_read_is_tenth_of_input(entry: Mapping[str, object]) -> bool:
|
||||
def cache_read_is_below_input(entry: Mapping[str, object]) -> bool:
|
||||
cache_read: Final = entry.get("cache_read_input_token_cost")
|
||||
input_cost: Final = entry.get("input_cost_per_token")
|
||||
return (
|
||||
isinstance(cache_read, float)
|
||||
and isinstance(input_cost, (int, float))
|
||||
and 0 < cache_read < input_cost
|
||||
and cache_read == pytest.approx(input_cost / 10)
|
||||
)
|
||||
return isinstance(cache_read, float) and isinstance(input_cost, (int, float)) and 0 < cache_read < input_cost
|
||||
|
||||
|
||||
@pytest.mark.parametrize("path", (PRICES_PATH, BACKUP_PRICES_PATH), ids=("main", "backup"))
|
||||
def test_active_mistral_chat_rows_price_cache_reads_below_input(path: Path):
|
||||
"""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."""
|
||||
active priced row must carry one, and it must be cheaper than a fresh input token."""
|
||||
rows: Mapping[str, object] = json.loads(path.read_text())
|
||||
drifted: Final = [
|
||||
f"{name}: cache_read={entry.get('cache_read_input_token_cost')} input={entry.get('input_cost_per_token')}"
|
||||
for name, entry in rows.items()
|
||||
if isinstance(entry, dict)
|
||||
and is_active_priced_mistral_chat_row(name, entry)
|
||||
and not cache_read_is_tenth_of_input(entry)
|
||||
and not cache_read_is_below_input(entry)
|
||||
]
|
||||
assert drifted == []
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue