Anthropic validates server_tool_use.id against ^srvtoolu_[a-zA-Z0-9_]+$ and 400s the whole request when one does not match. A combo that falls back to a provider with its own built-in tools (z.ai/glm emits OpenAI-style call_ ids for analyze_image) leaves such blocks in the history, so every later Claude turn fails. Extend normalizeClaudePassthrough to drop those blocks (reusing the existing loop), drop the paired tool_result / web_search_tool_result referencing a dropped id, and drop empty text blocks plus messages left with no content. Well-formed srvtoolu_ blocks and regular tool_use ids are untouched.
3.6 KiB
3.6 KiB