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
fix: nscale models
Ishaan Jafffcd51a8f4b43
diff --git a/litellm/__init__.py b/litellm/__init__.pyindex aea62a79b0a..fddcf76f4f9 100644--- a/litellm/__init__.py+++ b/litellm/__init__.py@@ -131,22 +131,22 @@ prometheus_initialize_budget_metrics: Optional[bool] = Falserequire_auth_for_metrics_endpoint: Optional[bool] = Falseargilla_batch_size: Optional[int] = Nonedatadog_use_v1: Optional[bool] = False # if you want to use v1 datadog logged payload-gcs_pub_sub_use_v1: Optional[bool] = (- False # if you want to use v1 gcs pubsub logged payload-)-generic_api_use_v1: Optional[bool] = (- False # if you want to use v1 generic api logged payload-)+gcs_pub_sub_use_v1: Optional[+ bool+] = False # if you want to use v1 gcs pubsub logged payload+generic_api_use_v1: Optional[+ bool+] = False # if you want to use v1 generic api logged payloadargilla_transformation_object: Optional[Dict[str, Any]] = None-_async_input_callback: List[Union[str, Callable, CustomLogger]] = (- []-) # internal variable - async custom callbacks are routed here.-_async_success_callback: List[Union[str, Callable, CustomLogger]] = (- []-) # internal variable - async custom callbacks are routed here.-_async_failure_callback: List[Union[str, Callable, CustomLogger]] = (- []-) # internal variable - async custom callbacks are routed here.+_async_input_callback: List[+ Union[str, Callable, CustomLogger]+] = [] # internal variable - async custom callbacks are routed here.+_async_success_callback: List[+ Union[str, Callable, CustomLogger]+] = [] # internal variable - async custom callbacks are routed here.+_async_failure_callback: List[+ Union[str, Callable, CustomLogger]+] = [] # internal variable - async custom callbacks are routed here.pre_call_rules: List[Callable] = []post_call_rules: List[Callable] = []turn_off_message_logging: Optional[bool] = False@@ -154,18 +154,18 @@ log_raw_request_response: bool = Falseredact_messages_in_exceptions: Optional[bool] = Falseredact_user_api_key_info: Optional[bool] = Falsefilter_invalid_headers: Optional[bool] = False-add_user_information_to_llm_headers: Optional[bool] = (- None # adds user_id, team_id, token hash (params from StandardLoggingMetadata) to request headers-)+add_user_information_to_llm_headers: Optional[+ bool+] = None # adds user_id, team_id, token hash (params from StandardLoggingMetadata) to request headersstore_audit_logs = False # Enterprise feature, allow users to see audit logs### end of callbacks #############-email: Optional[str] = (- None # Not used anymore, will be removed in next MAJOR release - https://github.com/BerriAI/litellm/discussions/648-)-token: Optional[str] = (- None # Not used anymore, will be removed in next MAJOR release - https://github.com/BerriAI/litellm/discussions/648-)+email: Optional[+ str+] = None # Not used anymore, will be removed in next MAJOR release - https://github.com/BerriAI/litellm/discussions/648+token: Optional[+ str+] = None # Not used anymore, will be removed in next MAJOR release - https://github.com/BerriAI/litellm/discussions/648telemetry = Truemax_tokens: int = DEFAULT_MAX_TOKENS # OpenAI Defaultsdrop_params = bool(os.getenv("LITELLM_DROP_PARAMS", False))@@ -242,24 +242,20 @@ enable_loadbalancing_on_batch_endpoints: Optional[bool] = Noneenable_caching_on_provider_specific_optional_params: bool = (False # feature-flag for caching on optional params - e.g. 'top_k')-caching: bool = (- False # Not used anymore, will be removed in next MAJOR release - https://github.com/BerriAI/litellm/discussions/648-)-caching_with_models: bool = (- False # # Not used anymore, will be removed in next MAJOR release - https://github.com/BerriAI/litellm/discussions/648-)-cache: Optional[Cache] = (- None # cache object <- use this - https://docs.litellm.ai/docs/caching-)+caching: bool = False # Not used anymore, will be removed in next MAJOR release - https://github.com/BerriAI/litellm/discussions/648+caching_with_models: bool = False # # Not used anymore, will be removed in next MAJOR release - https://github.com/BerriAI/litellm/discussions/648+cache: Optional[+ Cache+] = None # cache object <- use this - https://docs.litellm.ai/docs/cachingdefault_in_memory_ttl: Optional[float] = Nonedefault_redis_ttl: Optional[float] = Nonedefault_redis_batch_cache_expiry: Optional[float] = Nonemodel_alias_map: Dict[str, str] = {}model_group_alias_map: Dict[str, str] = {}max_budget: float = 0.0 # set the max budget across all providers-budget_duration: Optional[str] = (- None # proxy only - resets budget after fixed duration. You can set duration as seconds ("30s"), minutes ("30m"), hours ("30h"), days ("30d").-)+budget_duration: Optional[+ str+] = None # proxy only - resets budget after fixed duration. You can set duration as seconds ("30s"), minutes ("30m"), hours ("30h"), days ("30d").default_soft_budget: float = (DEFAULT_SOFT_BUDGET # by default all litellm proxy keys have a soft budget of 50.0)@@ -268,15 +264,11 @@ forward_traceparent_to_llm_provider: bool = False_current_cost = 0.0 # private variable, used if max budget is seterror_logs: Dict = {}-add_function_to_prompt: bool = (- False # if function calling not supported by api, append function call details to system prompt-)+add_function_to_prompt: bool = False # if function calling not supported by api, append function call details to system promptclient_session: Optional[httpx.Client] = Noneaclient_session: Optional[httpx.AsyncClient] = Nonemodel_fallbacks: Optional[List] = None # Deprecated for 'litellm.fallbacks'-model_cost_map_url: str = (- "https://raw.githubusercontent.com/BerriAI/litellm/main/model_prices_and_context_window.json"-)+model_cost_map_url: str = "https://raw.githubusercontent.com/BerriAI/litellm/main/model_prices_and_context_window.json"suppress_debug_info = Falsedynamodb_table_name: Optional[str] = Nones3_callback_params: Optional[Dict] = None@@ -299,9 +291,7 @@ disable_end_user_cost_tracking_prometheus_only: Optional[bool] = Nonecustom_prometheus_metadata_labels: List[str] = []#### REQUEST PRIORITIZATION ####priority_reservation: Optional[Dict[str, float]] = None-force_ipv4: bool = (- False # when True, litellm will force ipv4 for all LLM requests. Some users have seen httpx ConnectionError when using ipv6.-)+force_ipv4: bool = False # when True, litellm will force ipv4 for all LLM requests. Some users have seen httpx ConnectionError when using ipv6.module_level_aclient = AsyncHTTPHandler(timeout=request_timeout, client_alias="module level aclient")@@ -315,13 +305,13 @@ fallbacks: Optional[List] = Nonecontext_window_fallbacks: Optional[List] = Nonecontent_policy_fallbacks: Optional[List] = Noneallowed_fails: int = 3-num_retries_per_request: Optional[int] = (- None # for the request overall (incl. fallbacks + model retries)-)+num_retries_per_request: Optional[+ int+] = None # for the request overall (incl. fallbacks + model retries)####### SECRET MANAGERS #####################-secret_manager_client: Optional[Any] = (- None # list of instantiated key management clients - e.g. azure kv, infisical, etc.-)+secret_manager_client: Optional[+ Any+] = None # list of instantiated key management clients - e.g. azure kv, infisical, etc._google_kms_resource_name: Optional[str] = None_key_management_system: Optional[KeyManagementSystem] = None_key_management_settings: KeyManagementSettings = KeyManagementSettings()@@ -439,6 +429,7 @@ sambanova_models: List = []assemblyai_models: List = []snowflake_models: List = []llama_models: List = []+nscale_models: List = []def is_bedrock_pricing_only_model(key: str) -> bool:@@ -564,6 +555,8 @@ def add_known_models():deepseek_models.append(key)elif value.get("litellm_provider") == "meta_llama":llama_models.append(key)+ elif value.get("litellm_provider") == "nscale":+ nscale_models.append(key)elif value.get("litellm_provider") == "azure_ai":azure_ai_models.append(key)elif value.get("litellm_provider") == "voyage":@@ -675,6 +668,7 @@ model_list = (+ jina_ai_models+ snowflake_models+ llama_models+ + nscale_models)model_list_set = set(model_list)@@ -733,6 +727,7 @@ models_by_provider: dict = {"jina_ai": jina_ai_models,"snowflake": snowflake_models,"meta_llama": llama_models,+ "nscale": nscale_models,}# mapping for those models which have larger equivalents@@ -1093,10 +1088,10 @@ from .types.llms.custom_llm import CustomLLMItemfrom .types.utils import GenericStreamingChunkcustom_provider_map: List[CustomLLMItem] = []-_custom_providers: List[str] = (- []-) # internal helper util, used to track names of custom providers-disable_hf_tokenizer_download: Optional[bool] = (- None # disable huggingface tokenizer download. Defaults to openai clk100-)+_custom_providers: List[+ str+] = [] # internal helper util, used to track names of custom providers+disable_hf_tokenizer_download: Optional[+ bool+] = None # disable huggingface tokenizer download. Defaults to openai clk100global_disable_no_log_param: bool = False