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(utils.py): fix special keys list for provider-specific items in response object

Krrish Dholakia1a00f5225592
diff --git a/litellm/utils.py b/litellm/utils.py
index 70e000a1a02..0e1573784bc 100644
--- a/litellm/utils.py
+++ b/litellm/utils.py
@@ -5859,7 +5859,8 @@ def convert_to_model_response_object(
if _response_headers is not None:
model_response_object._response_headers = _response_headers
- special_keys = litellm.ModelResponse.model_fields.keys()
+ special_keys = list(litellm.ModelResponse.model_fields.keys())
+ special_keys.append("usage")
for k, v in response_object.items():
if k not in special_keys:
setattr(model_response_object, k, v)