Multi model usage for same agent session

We are using gemini as primary model for our agent when switched to OpenRouter model object I get error indicating that tool call has no name and with a single line change in the OpenAi like format_response method the problem has been solved

My question is has anyone encountered with this issue and is there more well formatted way to change it?


Error from open router

ERROR    API status error from OpenAI API: Error code: 400 - 


{'error': {'message': 'Provider returned error', 'code': 400, 'metadata': {'raw': '{\n  "error": {\n    "code": 400,\n            
         "message": "* GenerateContentRequest.contents[2].parts[0].function_response.name: Name cannot be empty.\\n",\n    "status": "INVALID_ARGUMENT"\n  }\n}\n', 'provider_name': 'Google AI
         Studio'}}, 'user_id': 'xxxxx'}

Hi @msnp, thanks for reaching out and supporting Agno. I’ve shared this with the team, we’re working through all requests one by one and will get back to you soon. We appreciate your patience!

Hey! Thanks for reaching out

Gemini requires the name field in tool responses, while OpenRouter’s OpenAI-compatible wrapper doesn’t include it by default. Native Gemini handles this automatically.

Here are some solutions:

Option 1 - Use Gemini:

from agno.models.google import Gemini

agent = Agent(model=Gemini(…))

Option 2 - Set Tool Response Names:

Message(
role=“tool”,
content=“result”,
tool_call_id=“call_123”,
name=“tool_response”  # ← Add this
)

Thank you for using Agno and please feel free to reach out if you need any further help :raising_hands: