diff --git a/litellm/llms/openai/responses/count_tokens/transformation.py b/litellm/llms/openai/responses/count_tokens/transformation.py index 3ee0f7eaa61..ca9526bc187 100644 --- a/litellm/llms/openai/responses/count_tokens/transformation.py +++ b/litellm/llms/openai/responses/count_tokens/transformation.py @@ -102,7 +102,7 @@ class OpenAICountTokensConfig: for msg in messages: role = msg.get("role", "") - content = msg.get("content", "") + content = msg.get("content") or "" if role in ("system", "developer"): # Extract system/developer messages as instructions