Trying to send a pdf as base 64 text but getting this error. Is pdf not yet working or is there something not right in my request?
============
{
“error”: {
“message”: “Invalid Value: ‘file’. This model does not support file content types.”,
“type”: “invalid_request_error”,
“param”: “messages[0].content[1].type”,
“code”: “invalid_value”
}
}
Message sent to gpt-4.1-2025-04-14 using the completion API:
{
“max_completion_tokens”: 16384,
“messages”: [
{
“content”: [
{
“text”: “This is the content of document Austenic.pdf”,
“type”: “text”
},
{
“file”: {
“file_data”: “data:application/pdf;base64,snip”,
“filename”: “Austenic.pdf”
},
“type”: “file”
},
{
“text”: “describe”,
“type”: “text”
}
],
“role”: “user”
}
],
“model”: “gpt-4.1-2025-04-14”,
“reasoning_effort”: “high”,
“store”: false,
“stream”: false,
“temperature”: 1
}
_j
May 26, 2025, 10:32am
2
Did you have any intention of actually adding the PDF file contents with an f-string?..
"file_data": f"data:application/pdf;base64,{pdf_files_list_b64[0]}"
from openai import OpenAI
client = OpenAI()
response = client.chat.completions.create(
model="gpt-4.1-2025-04-14",
messages=[
{
"role": "system",
"content": [
{
"type": "text",
"text": "A helpful and honest assistant"
}
]
},
{
"role": "user",
"content": [
{
"type": "text",
"text": "What are the price ratios between gpt-4.1 AI model sizes?"
},
{
"type": "file",
"file": {
"file_data": "data:application/pdf;base64,JVBERi0xLjMKJcfsj6IKNSAwIG9iago8PC9MZW5ndGggNiAwIFIvRmlsdGVyIC9GbGF0ZURlY29kZT4+CnN0cmVhb///////wMDAgbiAKMDAwMDAwMDQzOCAwMDAwMCBuIAowMDAwMDAwNTM4IDAwMDAwIG4gCjAwMDAwMDA0NzkgMDAwMDAgbiAKMDAwMDAwMDUwOCAwMDAwMCBuIAp0cmFpbGVyCjw8IC9TaXplIDExIC9Sb290IDEgMCBSIC9JbmZvIDIgMCBSCi9JRCBbPDlERThEOTdEODhBQzZGNEZDNTgyNUQ4RjM4M0M0NzBCPjw5REU4RDk3RDg4QUM2RjRGQzU4MjVEOEYzODNDNDcwQj5dCj4+CnN0YXJ0eHJlZgoxMjc1NzAyCiUlRU9GCg==",
"filename": "test2.pdf"
}
}
]
},
],
max_completion_tokens=2048,
top_p=0.5,
)
reasoning_effort is also not a supported parameter for that model.
update openAI library if using.
3 Likes
ticking off reasonning fixed it! Thanks,
2 Likes
im literally doing this but somehow still not working
rc/consumers/application-document-consumer.ts:204:9) {
status: 400,
headers: {
'apim-request-id': '6efeb34e-7686-4577-af70-b3b843466936',
'content-length': '218',
'content-type': 'application/json',
date: 'Mon, 16 Jun 2025 05:09:50 GMT',
'strict-transport-security': 'max-age=31536000; includeSubDomains; preload',
'x-content-type-options': 'nosniff',
'x-ms-deployment-name': 'gpt-4o',
'x-ms-rai-invoked': 'true',
'x-ms-region': 'Japan East',
'x-ratelimit-limit-requests': '4500',
'x-ratelimit-limit-tokens': '450000',
'x-ratelimit-remaining-requests': '4499',
'x-ratelimit-remaining-tokens': '448927',
'x-request-id': 'a6f7d2fc-005b-4289-baad-1edd928612e5'
},
request_id: 'a6f7d2fc-005b-4289-baad-1edd928612e5',
error: {
message: "Invalid Value: 'file'. This model does not support file content types.",
type: 'invalid_request_error',
param: 'messages[0].content[1].type',
code: 'invalid_value'
},
code: 'invalid_value',
param: 'messages[0].content[1].type',
type: 'invalid_request_error'
}
using it through azure
_j
June 16, 2025, 6:59am
5
On Azure you will need to specify the latest preview API version available in order to get API parameters that keep pace with OpenAI.
Did you get it running? I just tried it with API version 2025-04-01-preview on azure and got the same error as M_Afifudin_Abdullah. Which API version did you use?
I don’t think azure supports pdf uploads from what I’ve seen, even on 2025-04-01-preview , it doesn’t work and there is no evidence of it being supported. Ignore @_j
1 Like