File Input API throws error for PDF file which is Base64-encoded

Hello Team,

Reference documentation

You can send PDF file inputs as Base64-encoded inputs as well.

When I try the example provided, it results in error:

400 Missing required parameter: ‘messages[1].content[0].file.file_id’

I am using npm openai library 4.77.3

Has anyone tried this?

4 Likes

I am experiencing the same error.

1 Like

I got same error, hope they fix as soon as posible

1 Like

I’ve opened an issue. You can check it here 400 Missing required parameter: 'messages[1].content[0].file.file_id' · Issue #1389 · openai/openai-node · GitHub
The fix is simply to rename file_name to filename and add a // @ts-expect-error line above, to prevent the typescript error

This is being fixed now — sorry for the issues!

Which “this”: SDK, documentation, API? Notation that some base64 fields instead take a data URL?

Here’s a deliberate discovery of what was working and non-matching docs:


Fine-tune vision-compatible models are also erroring out on image input that work on chat completions when employing Responses.

I am also receiving a 400 error when using the correct OpenAI storage file ID of a previously uploaded file.

It was ultimately an issue with the SDK, which is now fixed. @dev.tringuyen @mazzocchitomi @sudarsangp can you try again?

I tried with npm openai library 4.87.4 and it works based on the docs.

@_j , Thanks for taking the time to provide a solution for this - been tearing my hair out, until now…

1 Like