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]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
Update litellm/llms/openai/responses/count_tokens/transformation.py
Cesar Garcia018750e0cdce
diff --git a/litellm/llms/openai/responses/count_tokens/transformation.py b/litellm/llms/openai/responses/count_tokens/transformation.pyindex a89e8dd7438..3ee0f7eaa61 100644--- a/litellm/llms/openai/responses/count_tokens/transformation.py+++ b/litellm/llms/openai/responses/count_tokens/transformation.py@@ -122,6 +122,8 @@ class OpenAICountTokensConfig:elif role == "assistant":# Map tool_calls to Responses API function_call itemstool_calls = msg.get("tool_calls")+ if content:+ input_items.append({"role": "assistant", "content": content})if tool_calls:for tc in tool_calls:func = tc.get("function", {})@@ -131,7 +133,7 @@ class OpenAICountTokensConfig:"name": func.get("name", ""),"arguments": func.get("arguments", ""),})- else:+ elif not content:input_items.append({"role": "assistant", "content": content})elif role == "tool":input_items.append({