codex icon indicating copy to clipboard operation
codex copied to clipboard

PDF support

Open pheuter opened this issue 1 year ago • 19 comments

Would love to be able to ask Codex about any text, pictures, charts, and tables in PDFs we provide.

pheuter avatar Aug 02 '25 13:08 pheuter

This would be great to have

Algorithon avatar Sep 15 '25 01:09 Algorithon

And add support for .xlsx as well. A lot of table and structure is available in that format.

robfordww avatar Oct 27 '25 13:10 robfordww

Yes, would love to put PDF and implement code from that paper.

shera-amit avatar Nov 03 '25 19:11 shera-amit

I think this is crucial to implement because people often implement things based on specifications or written documentation of some sort and you want the model to have the right context.

bogdan-barbu avatar Jan 28 '26 10:01 bogdan-barbu

👆🏻

alexgfaria avatar Jan 28 '26 17:01 alexgfaria

We need this. Codex examines pdfs either via OCR extraction or it has to convert the pages to images. Its methodology is inconsistent and it takes a long time. I don't understand why it doesn't treat them like file inputs, which the OpenAI API supports:

https://platform.openai.com/docs/guides/pdf-files

eugene-kim avatar Feb 06 '26 19:02 eugene-kim

+1

fedu avatar Feb 09 '26 08:02 fedu

Would be great to have native support for PDFs

shreyansh26 avatar Feb 21 '26 10:02 shreyansh26

I second this

mmmmie avatar Feb 21 '26 20:02 mmmmie

+1.

yicheny0580 avatar Feb 26 '26 18:02 yicheny0580

+1. All my docs are in pdf form and there are often issues

Chris-H0 avatar Feb 27 '26 15:02 Chris-H0

Oh man, this is mandatory. ChatGPT can do this, why not Codex (MacOS app)???

tomaszdudek7 avatar Mar 04 '26 09:03 tomaszdudek7

@pheuter @tomaszdudek7 @Chris-H0 @Suzuhana @mmmmie @eugene-kim @shera-amit and others You should try our fork of Codex that we developed for our internal R&D and recently open-sourced: https://github.com/Agents2AgentsAI/ata

It handles pdf files and urls natively, with extra tools to use for reading papers and doing research.

tho-ho avatar Mar 11 '26 21:03 tho-ho

could you add this feature? thank you.

jimmy-ren avatar Apr 26 '26 15:04 jimmy-ren

This feature is crucial for doing scientific work in Codex. I still struggle with PDFs in Codex. Being able to interpret diagrams and understand the sources I’m working with without preprocessing PDFs would be amazing.

Armg-fr avatar May 08 '26 10:05 Armg-fr

It’s been almost a year, but there still hasn’t been any follow-up on this. PDF support in Codex is really needed.

dodoman-sun avatar May 12 '26 05:05 dodoman-sun

The fact this issue is still open is astonishing.

I gave Codex a try today since there was a 1 month free trial. My project folder contained PDFs and I watched it try to pull the OCR first. Then it grabbed images for pages with handwritten text. The reasoning UI was so clunky as I watched it try to use tesseract and other tools to do this in the reasoning dialog. At the end, I didn't have confidence that it successfully got all the information from the PDFs in my project.

I paid $20 for Claude Code. The UI was cleaner, with just one line for a PDF read, and response quicker.

No regrets.

gurugautham avatar May 17 '26 05:05 gurugautham

Tried Codex to code a firmware function to read IIC registers according to the IC spec which is in pdf. It's struggling with reading the simple pdf doc. It's unbelievable that such thing is not supported natively.

qiqjiao avatar Jun 15 '26 05:06 qiqjiao

I reproduced the missing native PDF-input boundary through app-server and have a small proof of concept that may help narrow the implementation.

Reproduction

Using Codex app-server 0.151.0-alpha.7.2, start an ephemeral ChatGPT-authenticated thread and call thread/inject_items with a Responses API message containing:

{
  "type": "message",
  "role": "user",
  "content": [
    {
      "type": "input_file",
      "filename": "document.pdf",
      "file_data": "data:application/pdf;base64,...",
      "detail": "auto"
    }
  ]
}

The request is rejected locally, before any model call:

items[0] is not a valid response item: unknown variant `input_file`, expected one of `input_text`, `input_image`, `input_audio`, `output_text`

Root cause

ThreadInjectItemsParams.items deliberately accepts raw JSON values, but thread_inject_items_response_inner immediately deserializes each value into ResponseItem. A message's content is then constrained by codex_protocol::models::ContentItem, which currently cannot represent the documented Responses API input_file content item.

This prevents embedding clients from sending PDF bytes through the existing ChatGPT-subscription transport even though the backend accepts the standard file-input representation.

Proof of concept

I tested a local build that preserves an inline base64 input_file content item through this boundary. With the same isolated app-server flow, one live ChatGPT-authenticated gpt-5.6-luna request processed a 64,860-byte public PDF in 7.7 seconds, returned all requested document facts correctly under a strict output schema, and emitted no tool events. Stock 0.145.0 and 0.151.0-alpha.7.2 both reject the same item during local deserialization.

Suggested scope

The smallest useful first step would be app-server support for inline PDF input_file items, with explicit MIME/size validation and persistence/replay coverage. A codex exec --file convenience flag could be layered on later; app-server support alone would unblock reliable headless clients without requiring local OCR or page-image conversion.

I can provide a sanitized reproducer or additional test details if useful.

Khilo65 avatar Sep 02 '26 20:09 Khilo65