The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
Litellm dev contributor prs 01 31 2025 (#8168)
Krish Dholakia91ed05df2962
diff --git a/db_scripts/create_views.py b/db_scripts/create_views.pyindex 43226db23c1..3027b38958d 100644--- a/db_scripts/create_views.py+++ b/db_scripts/create_views.py@@ -168,11 +168,11 @@ async def check_view_exists(): # noqa: PLR0915print("MonthlyGlobalSpendPerUserPerKey Created!") # noqatry:- await db.query_raw("""SELECT 1 FROM DailyTagSpend LIMIT 1""")+ await db.query_raw("""SELECT 1 FROM "DailyTagSpend" LIMIT 1""")print("DailyTagSpend Exists!") # noqaexcept Exception:sql_query = """- CREATE OR REPLACE VIEW DailyTagSpend AS+ CREATE OR REPLACE VIEW "DailyTagSpend" ASSELECTjsonb_array_elements_text(request_tags) AS individual_request_tag,DATE(s."startTime") AS spend_date,diff --git a/litellm/litellm_core_utils/prompt_templates/factory.py b/litellm/litellm_core_utils/prompt_templates/factory.pyindex d1a25ce4505..dcc4ef00fa3 100644--- a/litellm/litellm_core_utils/prompt_templates/factory.py+++ b/litellm/litellm_core_utils/prompt_templates/factory.py@@ -2153,7 +2153,7 @@ def stringify_json_tool_call_content(messages: List) -> List:import base64import mimetypes-from cgi import parse_header+from email.message import Messageimport httpx@@ -2174,8 +2174,9 @@ from litellm.types.llms.bedrock import ToolUseBlock as BedrockToolUseBlockdef _parse_content_type(content_type: str) -> str:- main_type, _ = parse_header(content_type)- return main_type+ m = Message()+ m['content-type'] = content_type+ return m.get_content_type()class BedrockImageProcessor:diff --git a/litellm/model_prices_and_context_window_backup.json b/litellm/model_prices_and_context_window_backup.jsonindex d23fbed81fa..477edc33118 100644--- a/litellm/model_prices_and_context_window_backup.json+++ b/litellm/model_prices_and_context_window_backup.json@@ -211,7 +211,7 @@"cache_read_input_token_cost": 0.00000055,"litellm_provider": "openai","mode": "chat",- "supports_vision": true,+ "supports_vision": false,"supports_prompt_caching": true},"o3-mini-2025-01-31": {@@ -223,7 +223,7 @@"cache_read_input_token_cost": 0.00000055,"litellm_provider": "openai","mode": "chat",- "supports_vision": true,+ "supports_vision": false,"supports_prompt_caching": true},"o1-mini-2024-09-12": {@@ -929,6 +929,30 @@"input_cost_per_character": 0.000030,"litellm_provider": "openai"},+ "azure/o3-mini": {+ "max_tokens": 100000,+ "max_input_tokens": 200000,+ "max_output_tokens": 100000,+ "input_cost_per_token": 0.0000011,+ "output_cost_per_token": 0.0000044,+ "cache_read_input_token_cost": 0.00000055,+ "litellm_provider": "openai",+ "mode": "chat",+ "supports_vision": false,+ "supports_prompt_caching": true+ },+ "azure/o3-mini-2025-01-31": {+ "max_tokens": 100000,+ "max_input_tokens": 200000,+ "max_output_tokens": 100000,+ "input_cost_per_token": 0.0000011,+ "output_cost_per_token": 0.0000044,+ "cache_read_input_token_cost": 0.00000055,+ "litellm_provider": "openai",+ "mode": "chat",+ "supports_vision": false,+ "supports_prompt_caching": true+ },"azure/tts-1": {"mode": "audio_speech","input_cost_per_character": 0.000015,@@ -3876,6 +3900,16 @@"mode": "chat","supports_function_calling": true},+ "vertex_ai/codestral@2405": {+ "max_tokens": 128000,+ "max_input_tokens": 128000,+ "max_output_tokens": 128000,+ "input_cost_per_token": 0.0000002,+ "output_cost_per_token": 0.0000006,+ "litellm_provider": "vertex_ai-mistral_models",+ "mode": "chat",+ "supports_function_calling": true+ },"vertex_ai/imagegeneration@006": {"output_cost_per_image": 0.020,"litellm_provider": "vertex_ai-image-models",diff --git a/litellm/proxy/db/create_views.py b/litellm/proxy/db/create_views.pyindex 2fff3d08526..e9303077b18 100644--- a/litellm/proxy/db/create_views.py+++ b/litellm/proxy/db/create_views.py@@ -158,11 +158,11 @@ async def create_missing_views(db: _db): # noqa: PLR0915print("MonthlyGlobalSpendPerUserPerKey Created!") # noqatry:- await db.query_raw("""SELECT 1 FROM DailyTagSpend LIMIT 1""")+ await db.query_raw("""SELECT 1 FROM "DailyTagSpend" LIMIT 1""")print("DailyTagSpend Exists!") # noqaexcept Exception:sql_query = """- CREATE OR REPLACE VIEW DailyTagSpend AS+ CREATE OR REPLACE VIEW "DailyTagSpend" ASSELECTjsonb_array_elements_text(request_tags) AS individual_request_tag,DATE(s."startTime") AS spend_date,diff --git a/model_prices_and_context_window.json b/model_prices_and_context_window.jsonindex d23fbed81fa..477edc33118 100644--- a/model_prices_and_context_window.json+++ b/model_prices_and_context_window.json@@ -211,7 +211,7 @@"cache_read_input_token_cost": 0.00000055,"litellm_provider": "openai","mode": "chat",- "supports_vision": true,+ "supports_vision": false,"supports_prompt_caching": true},"o3-mini-2025-01-31": {@@ -223,7 +223,7 @@"cache_read_input_token_cost": 0.00000055,"litellm_provider": "openai","mode": "chat",- "supports_vision": true,+ "supports_vision": false,"supports_prompt_caching": true},"o1-mini-2024-09-12": {@@ -929,6 +929,30 @@"input_cost_per_character": 0.000030,"litellm_provider": "openai"},+ "azure/o3-mini": {+ "max_tokens": 100000,+ "max_input_tokens": 200000,+ "max_output_tokens": 100000,+ "input_cost_per_token": 0.0000011,+ "output_cost_per_token": 0.0000044,+ "cache_read_input_token_cost": 0.00000055,+ "litellm_provider": "openai",+ "mode": "chat",+ "supports_vision": false,+ "supports_prompt_caching": true+ },+ "azure/o3-mini-2025-01-31": {+ "max_tokens": 100000,+ "max_input_tokens": 200000,+ "max_output_tokens": 100000,+ "input_cost_per_token": 0.0000011,+ "output_cost_per_token": 0.0000044,+ "cache_read_input_token_cost": 0.00000055,+ "litellm_provider": "openai",+ "mode": "chat",+ "supports_vision": false,+ "supports_prompt_caching": true+ },"azure/tts-1": {"mode": "audio_speech","input_cost_per_character": 0.000015,@@ -3876,6 +3900,16 @@"mode": "chat","supports_function_calling": true},+ "vertex_ai/codestral@2405": {+ "max_tokens": 128000,+ "max_input_tokens": 128000,+ "max_output_tokens": 128000,+ "input_cost_per_token": 0.0000002,+ "output_cost_per_token": 0.0000006,+ "litellm_provider": "vertex_ai-mistral_models",+ "mode": "chat",+ "supports_function_calling": true+ },"vertex_ai/imagegeneration@006": {"output_cost_per_image": 0.020,"litellm_provider": "vertex_ai-image-models",diff --git a/tests/local_testing/test_batch_completions.py b/tests/local_testing/test_batch_completions.pyindex e8fef5249f5..0883fd36d77 100644--- a/tests/local_testing/test_batch_completions.py+++ b/tests/local_testing/test_batch_completions.py@@ -43,6 +43,9 @@ def test_batch_completions():except Timeout as e:print(f"IN TIMEOUT")pass+ except litellm.InternalServerError as e:+ print(f"IN INTERNAL SERVER ERROR")+ passexcept Exception as e:pytest.fail(f"An error occurred: {e}")