From aeec703c4e884cab562c36940cfefab88e53ae0a Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Tue, 18 Mar 2025 10:35:50 -0700 Subject: [PATCH] test(test_get_llm_provider.py): Minimal repro for https://github.com/BerriAI/litellm/issues/9291 --- tests/local_testing/test_get_llm_provider.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/local_testing/test_get_llm_provider.py b/tests/local_testing/test_get_llm_provider.py index c3f4c15c27..5872d4ea07 100644 --- a/tests/local_testing/test_get_llm_provider.py +++ b/tests/local_testing/test_get_llm_provider.py @@ -216,3 +216,20 @@ def test_bedrock_invoke_anthropic(): ) assert custom_llm_provider == "bedrock" assert model == "invoke/anthropic.claude-3-5-sonnet-20240620-v1:0" + + +def test_xai_api_base(): + args = { + "model": "xai/grok-2-vision-latest", + "custom_llm_provider": "xai", + "api_base": None, + "api_key": "xai-my-specialkey", + "litellm_params": None, + } + model, custom_llm_provider, dynamic_api_key, api_base = litellm.get_llm_provider( + **args + ) + assert custom_llm_provider == "xai" + assert model == "grok-2-vision-latest" + assert api_base == "https://api.x.ai/v1" + assert dynamic_api_key == "xai-my-specialkey"