From 92baebc4bd2a2bd66d4ae6f4c8785490e7b26fed Mon Sep 17 00:00:00 2001 From: Xingyao Wang Date: Mon, 12 Jan 2026 15:46:09 -0500 Subject: [PATCH] Remove prod/ prefix from litellm proxy model path (#12200) Co-authored-by: openhands --- enterprise/server/constants.py | 24 ++++--------------- .../tests/unit/test_saas_settings_store.py | 10 ++++---- 2 files changed, 9 insertions(+), 25 deletions(-) diff --git a/enterprise/server/constants.py b/enterprise/server/constants.py index 1dbe3384f2..ecd8419bef 100644 --- a/enterprise/server/constants.py +++ b/enterprise/server/constants.py @@ -73,36 +73,22 @@ PERMITTED_CORS_ORIGINS = [ def build_litellm_proxy_model_path(model_name: str) -> str: - """ - Build the LiteLLM proxy model path based on environment and model name. - - This utility constructs the full model path for LiteLLM proxy based on: - - Environment type (staging vs prod) - - The provided model name + """Build the LiteLLM proxy model path based on model name. Args: model_name: The base model name (e.g., 'claude-3-7-sonnet-20250219') Returns: - The full LiteLLM proxy model path (e.g., 'litellm_proxy/prod/claude-3-7-sonnet-20250219') + The full LiteLLM proxy model path (e.g., 'litellm_proxy/claude-3-7-sonnet-20250219') """ - - if 'prod' in model_name or 'litellm' in model_name or 'proxy' in model_name: + if 'litellm' in model_name: raise ValueError("Only include model name, don't include prefix") - prefix = 'litellm_proxy/' - - if not IS_STAGING_ENV and not IS_LOCAL_ENV: - prefix += 'prod/' - - return prefix + model_name + return 'litellm_proxy/' + model_name def get_default_litellm_model(): - """ - Construct proxy for litellm model based on user settings and environment type (staging vs prod) - if not set explicitly - """ + """Construct proxy for litellm model based on user settings if not set explicitly.""" if LITELLM_DEFAULT_MODEL: return LITELLM_DEFAULT_MODEL model = USER_SETTINGS_VERSION_TO_MODEL[CURRENT_USER_SETTINGS_VERSION] diff --git a/enterprise/tests/unit/test_saas_settings_store.py b/enterprise/tests/unit/test_saas_settings_store.py index cc16aac568..6e4e972dab 100644 --- a/enterprise/tests/unit/test_saas_settings_store.py +++ b/enterprise/tests/unit/test_saas_settings_store.py @@ -981,7 +981,7 @@ async def test_has_custom_settings_matches_old_default_model(settings_store): ), ): settings = Settings( - llm_model='litellm_proxy/prod/claude-3-5-sonnet-20241022', + llm_model='litellm_proxy/claude-3-5-sonnet-20241022', llm_base_url='http://default.url', ) @@ -1116,7 +1116,7 @@ async def test_update_settings_upgrades_user_from_old_defaults( ): # Arrange: User with old version using old defaults old_version = 1 - old_model = 'litellm_proxy/prod/claude-3-5-sonnet-20241022' + old_model = 'litellm_proxy/claude-3-5-sonnet-20241022' settings = Settings(llm_model=old_model, llm_base_url=LITE_LLM_API_URL) # Use a consistent test URL @@ -1137,7 +1137,7 @@ async def test_update_settings_upgrades_user_from_old_defaults( patch('storage.saas_settings_store.LITE_LLM_API_URL', test_base_url), patch( 'storage.saas_settings_store.get_default_litellm_model', - return_value='litellm_proxy/prod/claude-opus-4-5-20251101', + return_value='litellm_proxy/claude-opus-4-5-20251101', ), patch( 'server.auth.token_manager.TokenManager.get_user_info_from_user_id', @@ -1168,9 +1168,7 @@ async def test_update_settings_upgrades_user_from_old_defaults( # Assert: Settings upgraded to new defaults assert updated_settings is not None - assert ( - updated_settings.llm_model == 'litellm_proxy/prod/claude-opus-4-5-20251101' - ) + assert updated_settings.llm_model == 'litellm_proxy/claude-opus-4-5-20251101' assert updated_settings.llm_base_url == test_base_url