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
fix manus
Ishaan Jafferabeec38ada77
diff --git a/litellm/llms/manus/responses/transformation.py b/litellm/llms/manus/responses/transformation.pyindex 8e0a4a5a30f..fbbed19f8d4 100644--- a/litellm/llms/manus/responses/transformation.py+++ b/litellm/llms/manus/responses/transformation.py@@ -1,3 +1,4 @@+import uuidfrom typing import TYPE_CHECKING, Any, Dict, Optional, Tuple, Unionimport httpx@@ -227,6 +228,12 @@ class ManusResponsesAPIConfig(OpenAIResponsesAPIConfig):total_tokens=0,)+ # Ensure id is present - failed responses may not include it+ if "id" not in raw_response_json or raw_response_json.get("id") is None:+ # Generate a placeholder id for failed responses+ # This allows the response object to be created even when the API doesn't return an id+ raw_response_json["id"] = f"unknown-{uuid.uuid4().hex[:8]}"+try:response = ResponsesAPIResponse(**raw_response_json)except Exception:@@ -296,6 +303,28 @@ class ManusResponsesAPIConfig(OpenAIResponsesAPIConfig):raw_response_headers = dict(raw_response.headers)processed_headers = process_response_headers(raw_response_headers)+ # Ensure reasoning, text, output, and usage are present with defaults+ if "reasoning" not in raw_response_json or raw_response_json.get("reasoning") is None:+ raw_response_json["reasoning"] = {}++ if "text" not in raw_response_json or raw_response_json.get("text") is None:+ raw_response_json["text"] = {}++ if "output" not in raw_response_json or raw_response_json.get("output") is None:+ raw_response_json["output"] = []++ if "usage" not in raw_response_json or raw_response_json.get("usage") is None:+ raw_response_json["usage"] = ResponseAPIUsage(+ input_tokens=0,+ output_tokens=0,+ total_tokens=0,+ )++ # Ensure id is present - failed responses may not include it+ if "id" not in raw_response_json or raw_response_json.get("id") is None:+ # Generate a placeholder id for failed responses+ raw_response_json["id"] = f"unknown-{uuid.uuid4().hex[:8]}"+try:response = ResponsesAPIResponse(**raw_response_json)except Exception: