OpenAI models can accept files as input_file items. In the Responses API, you can send a file as Base64-encoded data, a file ID returned by the Files API (/v1/files), or an external URL.
How it works
input_file processing depends on the file type:
- PDF files: On models with vision capabilities, such as
gpt-4oand later models, the API extracts both text and page images and sends both to the model. - Non-PDF document and text files (for example,
.docx,.pptx,.txt, and code files): the API extracts text only. - Spreadsheet files (for example,
.xlsx,.csv,.tsv): the API runs a spreadsheet-specific augmentation flow (described below).
Use these related tools when they better match your task:
- Use File Search for retrieval over large files instead of passing them directly as
input_file. - Use Hosted Shell for spreadsheet-heavy tasks that need detailed analysis, such as aggregations, joins, charting, or custom calculations.
Non-PDF image and chart limitations
For non-PDF files, the API doesn’t extract embedded images or charts into the model context.
To preserve chart and diagram fidelity, convert the file to PDF first, then
send the PDF as input_file.
How spreadsheet augmentation works
For spreadsheet-like files (such as .xlsx, .xls, .csv, .tsv, and
.iif), input_file uses a spreadsheet-specific augmentation process.
Instead of passing entire sheets to the model, the API parses up to the first 1,000 rows per sheet and adds model-generated summary and header metadata so the model can work from a smaller, structured view of the data.
PDF detail levels
For PDF inputs in the Responses API, set the optional detail field on an
input_file item to auto, low, or high to control how the API processes
page images. If omitted, detail defaults to auto. For GPT-5.6 and later
models, auto uses high; for earlier models, it uses low. Use low for fewer
input tokens, or high for more visual detail, such as dense charts, small print,
or diagrams.
The detail setting only affects PDF page image processing. Text extracted from
the PDF is still included. Chat Completions file inputs don’t support detail.
A minimal Responses API request body with explicit high detail looks like this:
{
"model": "gpt-4.1",
"input": [
{
"role": "user",
"content": [
{
"type": "input_file",
"filename": "document.pdf",
"file_data": "data:application/pdf;base64,...",
"detail": "high"
},
{
"type": "input_text",
"text": "Summarize this document."
}
]
}
]
}
Accepted file types
The following table lists common file types accepted in input_file. The full
list of extensions and MIME types appears later on this page.
| Category | Common extensions |
|---|---|
| PDF files | .pdf |
| Text and code | .txt, .md, .json, .html, .xml, code files |
| Rich documents | .doc, .docx, .rtf, .odt |
| Presentations | .ppt, .pptx |
| Spreadsheets | .csv, .xls, .xlsx |
File URLs
You can provide file inputs by linking external URLs.