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
Merge branch 'litellm_internal_staging' into feature/improve-gigachat-provider
KnyazSh958d335dc0e9
diff --cc litellm/litellm_core_utils/get_litellm_params.pyindex b70eadb4c18,b8ef9d8cca7..57e1d6aa69e--- a/litellm/litellm_core_utils/get_litellm_params.py+++ b/litellm/litellm_core_utils/get_litellm_params.py@@@ -37,14 -19,37 +19,40 @@@ AWS_CREDENTIAL_KWARGS_KEYS = frozenset})+ # Pre-define optional kwargs keys as frozenset for O(1) lookups+ # These are extracted from kwargs only if present, avoiding unnecessary .get() calls+ OPTIONAL_KWARGS_KEYS = (+ frozenset(+ {+ "azure_ad_token",+ "tenant_id",+ "client_id",+ "client_secret",+ "azure_username",+ "azure_password",+ "azure_scope",+ "timeout",+ "gcs_bucket_name",+ "bucket_name",+ "vertex_credentials",+ "vertex_project",+ "vertex_location",+ "vertex_ai_project",+ "vertex_ai_location",+ "vertex_ai_credentials",++ "gigachat_scope",++ "gigachat_auth_url",++ "gigachat_access_token",+ "tpm",+ "rpm",+ "itpm",+ "otpm",+ "use_xai_oauth",+ }+ )+ | AWS_CREDENTIAL_KWARGS_KEYS+ )+# Backward-compatible alias for existing imports/tests._OPTIONAL_KWARGS_KEYS = OPTIONAL_KWARGS_KEYSdiff --cc litellm/litellm_core_utils/get_llm_provider_logic.pyindex ff095d007cc,487a7b7e25f..d3621193463--- a/litellm/litellm_core_utils/get_llm_provider_logic.py+++ b/litellm/litellm_core_utils/get_llm_provider_logic.py@@@ -346,9 -346,9 +346,12 @@@ def get_llm_providerelif endpoint == "https://pinstripes.io/v1":custom_llm_provider = "pinstripes"dynamic_api_key = get_secret_str("PINSTRIPES_API_KEY")+ elif endpoint == "https://api.meta.ai/v1":+ custom_llm_provider = "meta"+ dynamic_api_key = get_secret_str("META_API_KEY")+ elif endpoint == "https://gigachat.devices.sberbank.ru/api/v1":+ custom_llm_provider = "gigachat"+ dynamic_api_key = get_secret_str("GIGACHAT_API_KEY")if api_base is not None and not isinstance(api_base, str):raise Exception("api base needs to be a string. api_base={}".format(api_base))@@@ -472,16 -472,12 +475,14 @@@custom_llm_provider = "amazon_nova"elif model.startswith("sap/"):custom_llm_provider = "sap"+ elif model in litellm.gigachat_models or model.startswith("gigachat/"):+ custom_llm_provider = "gigachat"# Last resort for an otherwise-unknown model: a declarative- # fallback-generalization rule (e.g. routes future claude-* to anthropic).+ # fallback-generalization routing rule (e.g. routes future claude-* to anthropic).# Exact provider matches above always win; this only runs on a miss.if not custom_llm_provider:- generalization = match_fallback_generalization(model)- if generalization is not None:- custom_llm_provider = generalization.get("litellm_provider") or None+ custom_llm_provider = match_routing_generalization(model)if not custom_llm_provider:if litellm.suppress_debug_info is False:diff --cc litellm/litellm_core_utils/litellm_logging.pyindex 49296ae310f,461ab62b815..c269d6b8ac0--- a/litellm/litellm_core_utils/litellm_logging.py+++ b/litellm/litellm_core_utils/litellm_logging.py@@@ -72,9 -73,9 +72,10 @@@ from litellm.litellm_core_utils.model_pfrom litellm.litellm_core_utils.redact_messages import (redact_message_input_output_from_custom_logger,redact_message_input_output_from_logging,+ redact_streaming_responses_for_custom_logger,)from litellm.llms.base_llm.ocr.transformation import OCRResponse+from litellm.llms.base_llm.passthrough.transformation import BasePassthroughConfigfrom litellm.llms.base_llm.search.transformation import SearchResponsefrom litellm.responses.utils import ResponseAPILoggingUtilsfrom litellm.types.agents import LiteLLMSendMessageResponsediff --cc litellm/main.pyindex 095b5f8d825,6fd68921fb0..205c2de437e--- a/litellm/main.py+++ b/litellm/main.py@@@ -5322,10 -5325,7 +5325,10 @@@ def completion( # type: ignortpm=kwargs.get("tpm"),rpm=kwargs.get("rpm"),use_xai_oauth=kwargs.get("use_xai_oauth", False),- aws_bedrock_project_id=kwargs.get("aws_bedrock_project_id"),+ gigachat_scope=kwargs.get("gigachat_scope"),+ gigachat_auth_url=kwargs.get("gigachat_auth_url"),+ gigachat_access_token=kwargs.get("gigachat_access_token"),+ **{key: kwargs[key] for key in AWS_CREDENTIAL_KWARGS_KEYS if key in kwargs},)cast(LiteLLMLoggingObj, logging).update_environment_variables(model=model,