π OpenHands: AI-Driven Development
fix(openrouter): Force string serialization for openrouter/anthropic/claude-sonnet-4 model (#10454)
suixinioc64b1ae111ad
diff --git a/openhands/llm/llm.py b/openhands/llm/llm.pyindex 997f82fecb..3d76116af9 100644--- a/openhands/llm/llm.py+++ b/openhands/llm/llm.py@@ -850,6 +850,8 @@ class LLM(RetryMixin, DebugMixin):message.force_string_serializer = Trueif 'kimi-k2-instruct' in self.config.model and 'groq' in self.config.model:message.force_string_serializer = True+ if 'openrouter/anthropic/claude-sonnet-4' in self.config.model:+ message.force_string_serializer = True# let pydantic handle the serializationreturn [message.model_dump() for message in messages]