mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 02:34:29 +00:00
fix(model_cost_map): fix json parse error on model cost map + add unit test (#8629)
Fixes https://github.com/BerriAI/litellm/pull/8619#issuecomment-2666693045
This commit is contained in:
parent
49610485a2
commit
ea985dda0b
3 changed files with 38 additions and 1 deletions
|
@ -5328,6 +5328,28 @@
|
|||
"supports_vision": true,
|
||||
"supports_tool_choice": true
|
||||
},
|
||||
"openrouter/google/gemini-2.0-flash-001": {
|
||||
"max_tokens": 8192,
|
||||
"max_input_tokens": 1048576,
|
||||
"max_output_tokens": 8192,
|
||||
"max_images_per_prompt": 3000,
|
||||
"max_videos_per_prompt": 10,
|
||||
"max_video_length": 1,
|
||||
"max_audio_length_hours": 8.4,
|
||||
"max_audio_per_prompt": 1,
|
||||
"max_pdf_size_mb": 30,
|
||||
"input_cost_per_audio_token": 0.0000007,
|
||||
"input_cost_per_token": 0.0000001,
|
||||
"output_cost_per_token": 0.0000004,
|
||||
"litellm_provider": "openrouter",
|
||||
"mode": "chat",
|
||||
"supports_system_messages": true,
|
||||
"supports_function_calling": true,
|
||||
"supports_vision": true,
|
||||
"supports_response_schema": true,
|
||||
"supports_audio_output": true,
|
||||
"supports_tool_choice": true
|
||||
},
|
||||
"openrouter/mistralai/mixtral-8x22b-instruct": {
|
||||
"max_tokens": 65536,
|
||||
"input_cost_per_token": 0.00000065,
|
||||
|
|
|
@ -5348,7 +5348,7 @@
|
|||
"supports_vision": true,
|
||||
"supports_response_schema": true,
|
||||
"supports_audio_output": true,
|
||||
"supports_tool_choice": true,
|
||||
"supports_tool_choice": true
|
||||
},
|
||||
"openrouter/mistralai/mixtral-8x22b-instruct": {
|
||||
"max_tokens": 65536,
|
||||
|
|
|
@ -2961,3 +2961,18 @@ async def test_cost_calculator_with_custom_pricing_router(model_item, custom_pri
|
|||
)
|
||||
# assert resp.model == "random-model"
|
||||
assert resp._hidden_params["response_cost"] > 0
|
||||
|
||||
|
||||
def test_json_valid_model_cost_map():
|
||||
import json
|
||||
|
||||
os.environ["LITELLM_LOCAL_MODEL_COST_MAP"] = "True"
|
||||
|
||||
model_cost = litellm.get_model_cost_map(url="")
|
||||
|
||||
try:
|
||||
# Attempt to serialize and deserialize the JSON
|
||||
json_str = json.dumps(model_cost)
|
||||
json.loads(json_str)
|
||||
except json.JSONDecodeError as e:
|
||||
assert False, f"Invalid JSON format: {str(e)}"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue