diff --git a/litellm/main.py b/litellm/main.py index 6e26bf3e5e..a6d94b5171 100644 --- a/litellm/main.py +++ b/litellm/main.py @@ -211,9 +211,9 @@ def completion( openai.api_type = "openai" # note: if a user sets a custom base - we should ensure this works api_base = ( - custom_api_base or litellm.api_base or get_secret("OPENAI_API_BASE") + custom_api_base or litellm.api_base or get_secret("OPENAI_API_BASE") or "https://api.openai.com/v1" ) - openai.api_base = api_base or "https://api.openai.com/v1" + openai.api_base = api_base openai.api_version = None if litellm.organization: openai.organization = litellm.organization diff --git a/litellm/utils.py b/litellm/utils.py index 309d903963..eac0079cf8 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -1444,13 +1444,12 @@ def get_secret(secret_name): if litellm.secret_manager_client != None: # TODO: check which secret manager is being used # currently only supports Infisical - secret = litellm.secret_manager_client.get_secret( - secret_name).secret_value - if secret != None: - return secret # if secret found in secret manager return it - else: - raise ValueError( - f"Secret '{secret_name}' not found in secret manager") + try: + secret = litellm.secret_manager_client.get_secret( + secret_name).secret_value + except: + secret = None + return secret elif litellm.api_key != None: # if users use litellm default key return litellm.api_key else: