Skip to content

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]

Fix black

Sameer Kankute3eccededccfd
diff --git a/litellm/_logging.py b/litellm/_logging.py
index 82167776457..d072cc549d0 100644
--- a/litellm/_logging.py
+++ b/litellm/_logging.py
@@ -24,7 +24,6 @@ _ENABLE_SECRET_REDACTION = (
_REDACTED = "REDACTED"
-
def _build_secret_patterns() -> re.Pattern:
patterns: List[str] = [
# ── PEM private key / certificate blocks ──
diff --git a/litellm/cost_calculator.py b/litellm/cost_calculator.py
index 4d7b44bfbde..9b4dd80265c 100644
--- a/litellm/cost_calculator.py
+++ b/litellm/cost_calculator.py
@@ -513,7 +513,9 @@ def cost_per_token( # noqa: PLR0915
return fireworks_ai_cost_per_token(model=model, usage=usage_block)
elif custom_llm_provider == "azure":
return azure_openai_cost_per_token(
- model=model, usage=usage_block, response_time_ms=response_time_ms,
+ model=model,
+ usage=usage_block,
+ response_time_ms=response_time_ms,
service_tier=service_tier,
)
elif custom_llm_provider == "gemini":
diff --git a/litellm/llms/azure/cost_calculation.py b/litellm/llms/azure/cost_calculation.py
index 2e2e0c4965f..2a20c55a6ce 100644
--- a/litellm/llms/azure/cost_calculation.py
+++ b/litellm/llms/azure/cost_calculation.py
@@ -12,7 +12,9 @@ from litellm.utils import get_model_info
def cost_per_token(
- model: str, usage: Usage, response_time_ms: Optional[float] = 0.0,
+ model: str,
+ usage: Usage,
+ response_time_ms: Optional[float] = 0.0,
service_tier: Optional[str] = None,
) -> Tuple[float, float]:
"""
diff --git a/litellm/llms/vertex_ai/gemini/transformation.py b/litellm/llms/vertex_ai/gemini/transformation.py
index 4d1b714db98..f756c7a7c52 100644
--- a/litellm/llms/vertex_ai/gemini/transformation.py
+++ b/litellm/llms/vertex_ai/gemini/transformation.py
@@ -225,7 +225,7 @@ def _process_gemini_media(
# Gemini Files API references can be passed through as URI-only.
file_data = cast(FileDataType, {"file_uri": image_url})
part = {"file_data": file_data}
- return _apply_gemini_3_metadata(
+ return _apply_gemini_metadata(
part, model, media_resolution_enum, video_metadata
)
elif (
diff --git a/litellm/proxy/guardrails/guardrail_hooks/qohash/qohash.py b/litellm/proxy/guardrails/guardrail_hooks/qohash/qohash.py
index 7de15192d67..a1bab6dbac9 100644
--- a/litellm/proxy/guardrails/guardrail_hooks/qohash/qohash.py
+++ b/litellm/proxy/guardrails/guardrail_hooks/qohash/qohash.py
@@ -1,6 +1,7 @@
"""
Qostodian Nexus (by Qohash) — LiteLLM guardrail integration.
"""
+
import os
from typing import TYPE_CHECKING, Literal, Optional, Type
@@ -25,7 +26,9 @@ class QostodianNexus(GenericGuardrailAPI):
api_base: Optional[str] = None,
**kwargs,
):
- api_base = api_base or os.environ.get("QOSTODIAN_NEXUS_API_BASE", "http://nexus:8800")
+ api_base = api_base or os.environ.get(
+ "QOSTODIAN_NEXUS_API_BASE", "http://nexus:8800"
+ )
kwargs["guardrail_name"] = kwargs.get("guardrail_name", GUARDRAIL_NAME)
@@ -38,7 +41,9 @@ class QostodianNexus(GenericGuardrailAPI):
]
existing = kwargs.get("extra_headers") or []
- kwargs["extra_headers"] = nexus_headers + [h for h in existing if h not in nexus_headers]
+ kwargs["extra_headers"] = nexus_headers + [
+ h for h in existing if h not in nexus_headers
+ ]
super().__init__(
api_base=api_base,