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(utils.py): support 'PERPLEXITY_API_KEY' in env
Krrish Dholakia174b1c43e35c
diff --git a/litellm/utils.py b/litellm/utils.pyindex 61beabe9551..68eac7c3aec 100644--- a/litellm/utils.py+++ b/litellm/utils.py@@ -4610,7 +4610,11 @@ def get_llm_provider(if custom_llm_provider == "perplexity":# perplexity is openai compatible, we just need to set this to custom_openai and have the api_base be https://api.perplexity.aiapi_base = api_base or get_secret("PERPLEXITY_API_BASE") or "https://api.perplexity.ai" # type: ignore- dynamic_api_key = api_key or get_secret("PERPLEXITYAI_API_KEY")+ dynamic_api_key = (+ api_key+ or get_secret("PERPLEXITYAI_API_KEY")+ or get_secret("PERPLEXITY_API_KEY")+ )elif custom_llm_provider == "anyscale":# anyscale is openai compatible, we just need to set this to custom_openai and have the api_base be https://api.endpoints.anyscale.com/v1api_base = api_base or get_secret("ANYSCALE_API_BASE") or "https://api.endpoints.anyscale.com/v1" # type: ignore@@ -6647,7 +6651,6 @@ def exception_type(if message is not None and isinstance(message, str):message = message.replace("OPENAI", custom_llm_provider.upper())- message = message.replace("openai", custom_llm_provider)message = message.replace("OpenAI", custom_llm_provider)if custom_llm_provider == "openai":exception_provider = "OpenAI" + "Exception"