diff --git a/litellm/litellm_core_utils/get_llm_provider_logic.py b/litellm/litellm_core_utils/get_llm_provider_logic.py index cd160c919a3..d93cc39888f 100644 --- a/litellm/litellm_core_utils/get_llm_provider_logic.py +++ b/litellm/litellm_core_utils/get_llm_provider_logic.py @@ -290,7 +290,7 @@ def get_llm_provider( elif endpoint == litellm.NscaleConfig.API_BASE_URL: custom_llm_provider = "nscale" dynamic_api_key = litellm.NscaleConfig.get_api_key() - elif endpoint == "api.tokenfactory.nebius.com/v1": + elif endpoint == litellm.NebiusConfig.API_BASE_URL.removeprefix("https://"): custom_llm_provider = "nebius" dynamic_api_key = api_key or get_secret_str("NEBIUS_API_KEY") elif endpoint == "dashscope-intl.aliyuncs.com/compatible-mode/v1": @@ -608,7 +608,7 @@ def _get_openai_compatible_provider_info( api_base = api_base or get_secret("LLAMA_API_BASE") or "https://api.llama.com/compat/v1" dynamic_api_key = api_key or get_secret_str("LLAMA_API_KEY") elif custom_llm_provider == "nebius": - api_base = api_base or get_secret("NEBIUS_API_BASE") or "https://api.tokenfactory.nebius.com/v1" + api_base = api_base or get_secret("NEBIUS_API_BASE") or litellm.NebiusConfig.API_BASE_URL dynamic_api_key = api_key or get_secret_str("NEBIUS_API_KEY") elif custom_llm_provider == "ollama": api_base = api_base or get_secret("OLLAMA_API_BASE") or "http://localhost:11434" diff --git a/litellm/llms/nebius/chat/transformation.py b/litellm/llms/nebius/chat/transformation.py index 939d7dd5c16..93dc46470d8 100644 --- a/litellm/llms/nebius/chat/transformation.py +++ b/litellm/llms/nebius/chat/transformation.py @@ -6,6 +6,8 @@ from litellm.llms.openai.chat.gpt_transformation import OpenAIGPTConfig class NebiusConfig(OpenAIGPTConfig): + API_BASE_URL = "https://api.tokenfactory.nebius.com/v1" + def map_openai_params( self, non_default_params: dict, diff --git a/litellm/main.py b/litellm/main.py index e725397a081..efa933fe77f 100644 --- a/litellm/main.py +++ b/litellm/main.py @@ -6684,7 +6684,7 @@ def embedding( api_base or litellm.api_base or get_secret_str("NEBIUS_API_BASE") - or "https://api.tokenfactory.nebius.com/v1" + or litellm.NebiusConfig.API_BASE_URL ) response = openai_chat_completions.embedding(