diff --git a/litellm/llms/fireworks_ai/chat/transformation.py b/litellm/llms/fireworks_ai/chat/transformation.py index a7ea90ad408..33822ed9bf7 100644 --- a/litellm/llms/fireworks_ai/chat/transformation.py +++ b/litellm/llms/fireworks_ai/chat/transformation.py @@ -424,6 +424,8 @@ class FireworksAIConfig(OpenAIGPTConfig): ) if base_url.endswith("/inference/v1"): base_url = base_url[: -len("/inference/v1")] + elif base_url.endswith("/v1"): + base_url = base_url[: -len("/v1")] base_url = base_url.rstrip("/") headers = {"Authorization": f"Bearer {api_key}"} seen: set = set() diff --git a/tests/test_litellm/llms/fireworks_ai/chat/test_fireworks_ai_chat_transformation.py b/tests/test_litellm/llms/fireworks_ai/chat/test_fireworks_ai_chat_transformation.py index 591c5c82fbd..b07a1594d59 100644 --- a/tests/test_litellm/llms/fireworks_ai/chat/test_fireworks_ai_chat_transformation.py +++ b/tests/test_litellm/llms/fireworks_ai/chat/test_fireworks_ai_chat_transformation.py @@ -370,9 +370,13 @@ def test_get_models_account_id_equals_fireworks_no_duplicate_query(): "https://my-proxy.example.com/custom/", "https://my-proxy.example.com/custom/v1/accounts/fireworks/models", ), + ( + "https://my-proxy.example.com/v1", + "https://my-proxy.example.com/v1/accounts/fireworks/models", + ), (None, "https://api.fireworks.ai/v1/accounts/fireworks/models"), ], - ids=["plain-base", "inference-v1-stripped", "trailing-slash", "default"], + ids=["plain-base", "inference-v1-stripped", "trailing-slash", "bare-v1-stripped", "default"], ) def test_get_models_respects_api_base(api_base, expected_base): """get_models should use api_base (or FIREWORKS_API_BASE) instead of hardcoding."""