diff --git a/litellm/constants.py b/litellm/constants.py index c38a000a684..ffade35881d 100644 --- a/litellm/constants.py +++ b/litellm/constants.py @@ -149,7 +149,7 @@ MCP_HEALTH_CHECK_TIMEOUT = float(os.getenv("LITELLM_MCP_HEALTH_CHECK_TIMEOUT", " _MCP_STDIO_EXTRA_COMMANDS = os.getenv("LITELLM_MCP_STDIO_EXTRA_COMMANDS", "") MCP_STDIO_ALLOWED_COMMANDS: frozenset = frozenset( {"npx", "uvx", "python", "python3", "node", "docker", "deno"} - | (set(_MCP_STDIO_EXTRA_COMMANDS.split(",")) - {""}) + | {c.strip() for c in _MCP_STDIO_EXTRA_COMMANDS.split(",") if c.strip()} ) LITELLM_UI_ALLOW_HEADERS = [ diff --git a/litellm/integrations/opentelemetry.py b/litellm/integrations/opentelemetry.py index ac18ab7f547..8d708ea939c 100644 --- a/litellm/integrations/opentelemetry.py +++ b/litellm/integrations/opentelemetry.py @@ -657,9 +657,9 @@ class OpenTelemetry(CustomLogger): def _get_dynamic_otel_headers_from_kwargs(self, kwargs) -> Optional[dict]: """Extract dynamic headers from kwargs if available.""" - standard_callback_dynamic_params: Optional[ - StandardCallbackDynamicParams - ] = kwargs.get("standard_callback_dynamic_params") + standard_callback_dynamic_params: Optional[StandardCallbackDynamicParams] = ( + kwargs.get("standard_callback_dynamic_params") + ) if not standard_callback_dynamic_params: return None @@ -2096,7 +2096,7 @@ class OpenTelemetry(CustomLogger): original_export = exporter.export parent = self - def _export_with_failure_tracking(self, spans): + def _export_with_failure_tracking(_exporter_self, spans): try: result = original_export(spans) except Exception: diff --git a/litellm/llms/bedrock/common_utils.py b/litellm/llms/bedrock/common_utils.py index 3072052f885..2d6ab07f7f9 100644 --- a/litellm/llms/bedrock/common_utils.py +++ b/litellm/llms/bedrock/common_utils.py @@ -158,7 +158,7 @@ def _bedrock_invoke_embedded_region_names() -> frozenset: def strip_bedrock_routing_prefix(model: str) -> str: - """Strip one LiteLLM routing prefix (bedrock/, converse/, etc.).""" + """Strip all LiteLLM routing prefixes (bedrock/, converse/, invoke/, etc.).""" s = model for prefix in ("bedrock/", "converse/", "invoke/", "openai/", "nova-2/", "nova/"): if s.startswith(prefix): diff --git a/litellm/types/router.py b/litellm/types/router.py index af4f7b5b5bc..b0065433470 100644 --- a/litellm/types/router.py +++ b/litellm/types/router.py @@ -95,16 +95,18 @@ class ModelInfo(BaseModel): id: Optional[ str ] # Allow id to be optional on input, but it will always be present as a str in the model instance - db_model: bool = False # used for proxy - to separate models which are stored in the db vs. config. + db_model: bool = ( + False # used for proxy - to separate models which are stored in the db vs. config. + ) updated_at: Optional[datetime.datetime] = None updated_by: Optional[str] = None created_at: Optional[datetime.datetime] = None created_by: Optional[str] = None - base_model: Optional[ - str - ] = None # specify if the base model is azure/gpt-3.5-turbo etc for accurate cost tracking + base_model: Optional[str] = ( + None # specify if the base model is azure/gpt-3.5-turbo etc for accurate cost tracking + ) tier: Optional[Literal["free", "paid"]] = None """ @@ -173,12 +175,12 @@ class GenericLiteLLMParams(CredentialLiteLLMParams, CustomPricingLiteLLMParams): custom_llm_provider: Optional[str] = None tpm: Optional[int] = None rpm: Optional[int] = None - timeout: Optional[ - Union[float, str, httpx.Timeout] - ] = None # if str, pass in as os.environ/ - stream_timeout: Optional[ - Union[float, str] - ] = None # timeout when making stream=True calls, if str, pass in as os.environ/ + timeout: Optional[Union[float, str, httpx.Timeout]] = ( + None # if str, pass in as os.environ/ + ) + stream_timeout: Optional[Union[float, str]] = ( + None # timeout when making stream=True calls, if str, pass in as os.environ/ + ) max_retries: Optional[int] = None organization: Optional[str] = None # for openai orgs configurable_clientside_auth_params: CONFIGURABLE_CLIENTSIDE_AUTH_PARAMS = None @@ -342,6 +344,8 @@ class LiteLLMParamsTypedDict(TypedDict, total=False): input_cost_per_second: Optional[float] output_cost_per_second: Optional[float] output_cost_per_second_1080p: Optional[float] + output_cost_per_second_720p: Optional[float] + output_cost_per_second_4k: Optional[float] num_retries: Optional[int] ## MOCK RESPONSES ## mock_response: Optional[Union[str, ModelResponse, Exception]] diff --git a/litellm/types/utils.py b/litellm/types/utils.py index 483a0e4bf56..def2689b0df 100644 --- a/litellm/types/utils.py +++ b/litellm/types/utils.py @@ -234,7 +234,11 @@ class ModelInfoBase(ProviderSpecificModelInfo, total=False): output_cost_per_second: Optional[float] # for OpenAI Speech models output_cost_per_second_1080p: Optional[ float - ] # video_generation tier: key output_cost_per_second_ (e.g. 1080p, 720p) + ] # video_generation tier: key output_cost_per_second_ (e.g. 1080p, 720p, 4k) + output_cost_per_second_720p: Optional[ + float + ] # video_generation tier: 720p resolution + output_cost_per_second_4k: Optional[float] # video_generation tier: 4k resolution ocr_cost_per_page: Optional[float] # for OCR models annotation_cost_per_page: Optional[float] # for OCR models search_context_cost_per_query: Optional[ @@ -2966,6 +2970,8 @@ class CustomPricingLiteLLMParams(BaseModel): input_cost_per_second: Optional[float] = None output_cost_per_second: Optional[float] = None output_cost_per_second_1080p: Optional[float] = None + output_cost_per_second_720p: Optional[float] = None + output_cost_per_second_4k: Optional[float] = None input_cost_per_pixel: Optional[float] = None output_cost_per_pixel: Optional[float] = None