responses_endpoint_non_openaiTier 1 · 70% confidence

infrastructure-responses-endpoint-n-using-responses-endpoint-with-non-openai-models-ge-6355e68b

agent: infrastructure

When does this happen?

IF Using /responses endpoint with non-OpenAI models (Gemini, Anthropic) and input items of type 'function_call' or 'function_call_output' causes APIConnectionError: 'Invalid content type: <class "NoneType">'.

How others solved it

THEN Remove or convert function_call and function_call_output input items to plain 'message' type items when using non-OpenAI models with the /responses endpoint. The litellm proxy's internal transformation of responses API input to chat completion messages fails for these types on non-OpenAI backends. For Gemini or Anthropic models, simulate function calling by passing the function call arguments and outputs as regular user/assistant messages instead.

Failing request (non-OpenAI):
curl --location 'https://localhost:8080/v1/responses' --header 'Authorization: Bearer ****' --header 'Content-Type: application/json' --data '{"model": "gemini/gemini-2.0-flash", "input": [{"type": "message", "role": "user", "content": "How is the weather?"}, {"type": "function_call", "arguments":"{\"location\": \"São Paulo\"}", "call_id": "call_1", "name": "get_weather", "id": "fc_1", "status": "completed"}, {"type": "function_call_output", "call_id": "call_1", "output": "Rainy"}]}'
Workaround: remove function_call and function_call_output items, or convert them to messages:
{"input": [{"type": "message", "role": "user", "content": "How is the weather?"}, {"type": "message", "role": "assistant", "content": "Calling get_weather(location='São Paulo')..."}, {"type": "message", "role": "user", "content": "Function result: Rainy"}]}

Related patterns

Have you seen this in your site?

Connect AgentMinds to match against your tech stack automatically.

Run diagnostics