Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

fix: make LITELLM_CLIENT_SPECIFIC_PARAMS a tuple to prevent TypeError

Ryan Crabbe9e1d83e3de5d
diff --git a/litellm/llms/openai/common_utils.py b/litellm/llms/openai/common_utils.py
index a89f7f9c2b9..a05482c8004 100644
--- a/litellm/llms/openai/common_utils.py
+++ b/litellm/llms/openai/common_utils.py
@@ -168,12 +168,12 @@ class BaseOpenAILLM:
f"is_async={client_initialization_params.get('is_async')}",
]
- LITELLM_CLIENT_SPECIFIC_PARAMS = [
+ LITELLM_CLIENT_SPECIFIC_PARAMS = (
"timeout",
"max_retries",
"organization",
"api_base",
- ]
+ )
openai_client_fields = (
BaseOpenAILLM.get_openai_client_initialization_param_fields(
client_type=client_type
diff --git a/tests/test_litellm/llms/openai/test_openai_common_utils.py b/tests/test_litellm/llms/openai/test_openai_common_utils.py
index d0dedd3ed9b..8489040660b 100644
--- a/tests/test_litellm/llms/openai/test_openai_common_utils.py
+++ b/tests/test_litellm/llms/openai/test_openai_common_utils.py
@@ -164,3 +164,14 @@ def test_get_openai_client_initialization_param_fields(client_type):
assert isinstance(result, tuple)
assert len(result) > 0
assert "self" not in result
+
+
[email protected]("client_type", ["openai", "azure"])
+def test_get_openai_client_cache_key(client_type):
+ """Verify get_openai_client_cache_key doesn't raise on tuple + tuple concatenation."""
+ key = BaseOpenAILLM.get_openai_client_cache_key(
+ client_initialization_params={"api_key": "sk-test"},
+ client_type=client_type,
+ )
+ assert isinstance(key, str)
+ assert "api_key=sk-test" in key