diff --git a/litellm/litellm_core_utils/get_llm_provider_logic.py b/litellm/litellm_core_utils/get_llm_provider_logic.py index 373f813ac8e..d9c5e35286d 100644 --- a/litellm/litellm_core_utils/get_llm_provider_logic.py +++ b/litellm/litellm_core_utils/get_llm_provider_logic.py @@ -683,6 +683,15 @@ def _get_openai_compatible_provider_info( # noqa: PLR0915 ) = litellm.LMStudioChatConfig()._get_openai_compatible_provider_info( api_base, api_key ) + elif custom_llm_provider == "chuizi": + # chuizi is openai compatible, unified AI gateway + api_base = ( + api_base + or get_secret("CHUIZI_API_BASE") + or "https://api.chuizi.ai/v1" + ) # type: ignore + + dynamic_api_key = api_key or get_secret_str("CHUIZI_API_KEY") elif custom_llm_provider == "deepseek": # deepseek is openai compatible, we just need to set this to custom_openai and have the api_base be https://api.deepseek.com/v1 api_base = ( diff --git a/tests/local_testing/test_get_llm_provider.py b/tests/local_testing/test_get_llm_provider.py index af0e92e2f47..1535ce513cb 100644 --- a/tests/local_testing/test_get_llm_provider.py +++ b/tests/local_testing/test_get_llm_provider.py @@ -420,3 +420,25 @@ def test_get_llm_provider_use_proxy_arg_true_with_direct_args(): assert provider == "litellm_proxy" assert key == arg_api_key # Should use the argument key assert base == arg_api_base # Should use the argument base + + +def test_get_llm_provider_chuizi(): + """Test that chuizi/ prefix routes to chuizi provider.""" + model, custom_llm_provider, dynamic_api_key, api_base = litellm.get_llm_provider( + model="chuizi/anthropic/claude-sonnet-4-6", + ) + assert custom_llm_provider == "chuizi" + assert model == "anthropic/claude-sonnet-4-6" + assert api_base == "https://api.chuizi.ai/v1" + + +def test_get_llm_provider_chuizi_with_api_key(): + """Test that chuizi provider resolves CHUIZI_API_KEY from env.""" + os.environ["CHUIZI_API_KEY"] = "test-chuizi-key" + model, custom_llm_provider, dynamic_api_key, api_base = litellm.get_llm_provider( + model="chuizi/openai/gpt-4.1", + ) + assert custom_llm_provider == "chuizi" + assert model == "openai/gpt-4.1" + assert dynamic_api_key == "test-chuizi-key" + os.environ.pop("CHUIZI_API_KEY", None)