Hi everyone,
I’m trying to use the new native PDF processing capability with gpt-4o by sending a Base64 encoded file directly in the payload. However, the API keeps returning a 400 Bad Request with the following error:
"body": { "error": { "message": "invalid 'input[0].content[1].file_data'.", "type": "invalid_request_error", "param": "input[0].content[1].file_data", "code": "invalid_value" } }
I’ve checked the documentation, but the structure for the new input and input_file parameters seems to be causing this validation error. Here is the schema I am using (sensitive values omitted):
{
“model”: “gpt-4o”,
“text”: {
“format”: {
“type”: “json_object”
}
},
“input”: [
{
“role”: “user”,
“content”: [
{
“type”: “input_text”,
“text”: “[Detailed forensic prompt instructions here]”
},
{
“type”: “input_file”,
“filename”: “document.pdf”,
“file_data”: “[Base64_Encoded_PDF_String]”
}
]
}
]
}
The model used is gpt-4o.
- I am hitting the
/v1/chat/completionsendpoint (or the latest Responses API equivalent).
Has the schema for file_data or input_file changed recently? Does it require a specific API version header?
Any help would be appreciated!