-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Description
Confirm this is an issue with the Python library and not an underlying OpenAI API
- This is an issue with the Python library
Describe the bug
Context:
While migrating from the POST /v1/chat/completions
endpoint to POST /v1/responses
, I encountered issues with some previously valid payloads used by my agent system. After investigating, I found inconsistencies related to the usage of the assistant
role with tool_calls
, and the tool
role itself.
In the older endpoint (/chat/completions
), I’ve been successfully using a complex conversational flow where multiple roles are interleaved to allow autonomous interactions between the agent, tools, and users.
Working payload in /chat/completions
{
"input": [
{
"role": "developer",
"content": "prompt"
},
{
"role": "user",
"content": "..."
},
{
"role": "assistant",
"tool_calls": { ... }
},
{
"role": "tool",
"content": "...",
"tool_call_id": "call_xxxx"
},
{
"role": "developer",
"content": "..."
}
]
}
Issues encountered when using /v1/responses
Error with assistant
+ tool_calls
:
{
"error": {
"message": "Unknown parameter: 'input[3].tool_calls'.",
"type": "invalid_request_error",
"param": "input[3].tool_calls",
"code": "unknown_parameter"
}
}
Error with tool
role:
{
"error": {
"message": "Invalid value: 'tool'. Supported values are: 'assistant', 'system', 'developer', and 'user'.",
"type": "invalid_request_error",
"param": "input[3]",
"code": "invalid_value"
}
}
Questions
The official OpenAI documentation does not yet provide detailed guidance on the differences in role support between the two endpoints especially around tool interactions.
Therefore, I’d like to clarify:
- Does the
/v1/responses
endpoint support messages withrole: assistant
containingtool_calls
? - Has the
tool
role been deprecated in the new API, or is there an alternative way to represent tool responses? - Is there any migration documentation that specifically covers how to adapt this kind of tool-augmented, multi-turn agent flow?
This tool-based multi-role setup is critical for more advanced agents capable of autonomous reasoning and external action execution. If /responses no longer supports these structures, it significantly limits the usability of autonomous agents with tools.
Sincerely,
Filipe Rocha
To Reproduce
The error consistently occurs both when using the OpenAI SDK and when sending raw requests via cURL, which suggests it's not a client-side issue.
curl --location 'https://api.openai.com/v1/responses' \
--header 'Authorization: Bearer xxxxxxxxx' \
--header 'Content-Type: application/json' \
--data '{
"model": "gpt-4.1",
"temperature": 0,
"top_p": 1,
"max_output_tokens": 2048,
"input": [
{
"role": "developer",
"content": "prompt"
},
{
"role": "user",
"content": "user demand"
},
{
"role": "user",
"content": "user demand"
},
{
"role": "assistant",
"content": [],
"tool_calls": [
{
"id": "call_hCvlhe2zU31tkId6iRbT23gC",
"type": "function",
"function": {
"arguments": "{}",
"name": "name"
}
}
]
},
{
"role": "tool",
"content": "....",
"tool_call_id": "call_hCvlhe2zU31tkId6iRbT23gC"
},
{
"role": "assistant",
"content": "..."
},
{
"role": "assistant",
"content": "..."
},
{
"role": "developer",
"content": "prompt"
}
],
"tools": [
{
"type": "function",
"parameters": {
"properties": {
"monologo_interno_do_aborto": {
"description": "description",
"type": "string"
}
},
"required": [
"monologo_interno_do_aborto"
],
"type": "object"
},
"name": "abortar_planejamento",
"description": "description"
}
]
}'
Code snippets
params = {
**params.to_payload(),
"model": model_config.model,
}
responses = await client.responses.create(**params)
OS
macOS
Python version
v3.9.6
Library version
v1.108.0