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(base_llm): filter all _-prefixed class attrs from get_config

mateo-berrie780a7c1dc62
diff --git a/litellm/llms/base_llm/chat/transformation.py b/litellm/llms/base_llm/chat/transformation.py
index b71ae0fddee..e36ba0c14a1 100644
--- a/litellm/llms/base_llm/chat/transformation.py
+++ b/litellm/llms/base_llm/chat/transformation.py
@@ -84,12 +84,16 @@ class BaseConfig(ABC):
@classmethod
def get_config(cls):
+ # Subclasses lean on this to surface their public default settings
+ # (e.g. ``max_tokens``) as request params. Anything ``_``-prefixed is
+ # treated as private (lookup tables, ABC machinery, internal flags)
+ # and must not leak into the wire body — a tuple/dict/frozenset class
+ # attribute would otherwise serialise into the request as an extra
+ # top-level key and the provider would 400 it.
return {
k: v
for k, v in cls.__dict__.items()
- if not k.startswith("__")
- and not k.startswith("_abc")
- and not k.startswith("_is_base_class")
+ if not k.startswith("_")
and not isinstance(
v,
(
diff --git a/litellm/llms/bedrock/chat/converse_transformation.py b/litellm/llms/bedrock/chat/converse_transformation.py
index 7fd6a87d9d9..f711e88df6e 100644
--- a/litellm/llms/bedrock/chat/converse_transformation.py
+++ b/litellm/llms/bedrock/chat/converse_transformation.py
@@ -189,10 +189,12 @@ class AmazonConverseConfig(BaseConfig):
@classmethod
def get_config(cls):
+ # ``_``-prefixed names are private (lookup tables, ABC machinery,
+ # internal flags) and must not leak into the wire body.
return {
k: v
for k, v in cls.__dict__.items()
- if not k.startswith("__")
+ if not k.startswith("_")
and not isinstance(
v,
(