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]

test fixes for masker

Ishaan Jaffer58a56babd93a
diff --git a/litellm/litellm_core_utils/sensitive_data_masker.py b/litellm/litellm_core_utils/sensitive_data_masker.py
index ea0bed30416..c6906b26236 100644
--- a/litellm/litellm_core_utils/sensitive_data_masker.py
+++ b/litellm/litellm_core_utils/sensitive_data_masker.py
@@ -59,17 +59,22 @@ class SensitiveDataMasker:
data: Dict[str, Any],
depth: int = 0,
max_depth: int = DEFAULT_MAX_RECURSE_DEPTH_SENSITIVE_DATA_MASKER,
+ excluded_keys: Optional[Set[str]] = None,
) -> Dict[str, Any]:
if depth >= max_depth:
return data
+ excluded_keys = excluded_keys or set()
masked_data: Dict[str, Any] = {}
for k, v in data.items():
try:
if isinstance(v, dict):
- masked_data[k] = self.mask_dict(v, depth + 1)
+ masked_data[k] = self.mask_dict(v, depth + 1, max_depth, excluded_keys)
elif hasattr(v, "__dict__") and not isinstance(v, type):
- masked_data[k] = self.mask_dict(vars(v), depth + 1)
+ masked_data[k] = self.mask_dict(vars(v), depth + 1, max_depth, excluded_keys)
+ elif k in excluded_keys:
+ # Don't mask keys that are explicitly excluded
+ masked_data[k] = v
elif self.is_sensitive_key(k):
str_value = str(v) if v is not None else ""
masked_data[k] = self._mask_value(str_value)
diff --git a/litellm/model_prices_and_context_window_backup.json b/litellm/model_prices_and_context_window_backup.json
index fb3d4c91710..0cede07df99 100644
--- a/litellm/model_prices_and_context_window_backup.json
+++ b/litellm/model_prices_and_context_window_backup.json
@@ -13115,6 +13115,8 @@
"mode": "image_generation",
"output_cost_per_image": 0.134,
"output_cost_per_token": 1.2e-05,
+ "rpm": 1000,
+ "tpm": 4000000,
"output_cost_per_token_batches": 6e-06,
"source": "https://ai.google.dev/gemini-api/docs/pricing",
"supported_endpoints": [
diff --git a/model_prices_and_context_window.json b/model_prices_and_context_window.json
index fb3d4c91710..0cede07df99 100644
--- a/model_prices_and_context_window.json
+++ b/model_prices_and_context_window.json
@@ -13115,6 +13115,8 @@
"mode": "image_generation",
"output_cost_per_image": 0.134,
"output_cost_per_token": 1.2e-05,
+ "rpm": 1000,
+ "tpm": 4000000,
"output_cost_per_token_batches": 6e-06,
"source": "https://ai.google.dev/gemini-api/docs/pricing",
"supported_endpoints": [