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 Garcia1fb38dfa311e
diff --git a/litellm/llms/openai/responses/count_tokens/transformation.py b/litellm/llms/openai/responses/count_tokens/transformation.pyindex ca9526bc187..b9b36dcbea5 100644--- a/litellm/llms/openai/responses/count_tokens/transformation.py+++ b/litellm/llms/openai/responses/count_tokens/transformation.py@@ -118,6 +118,16 @@ class OpenAICountTokensConfig:text_parts.append(block)instructions_parts.append("\n".join(text_parts))elif role == "user":+ if isinstance(content, list):+ # Extract text from content blocks for Responses API+ text_parts = []+ for block in content:+ if isinstance(block, dict) and block.get("type") == "text":+ text_parts.append(block.get("text", ""))+ elif isinstance(block, str):+ text_parts.append(block)+ content = "\n".join(text_parts)+ input_items.append({"role": "user", "content": content})input_items.append({"role": "user", "content": content})elif role == "assistant":# Map tool_calls to Responses API function_call items