Solutions

Can OpenCode read a PDF?

Updated

Quick Answer

Only with a model that accepts PDF input: OpenCode's documentation says a PDF attachment needs such a model, and that an unsupported attachment is replaced by a short note. Converting to text removes the dependency. In Forkbench, PDF, Word, Excel and PowerPoint files kept in Files reach OpenCode as Markdown from read_file, so the document works with every model you switch to.

OpenCode lets you run whatever model you like, which is the point of it. It also means a PDF that one model reads is, for the next model, replaced by a note saying it could not be sent, and a Word file or spreadsheet is binary to all of them.

Community plugins can parse files inside OpenCode too, and they work. What Forkbench adds is where the document lives and who may read it: outside the project, encrypted, exposed to one thread, and read the same way by OpenCode and every other agent you run beside it. The conversion runs on your Mac in a process cut off from the network and your files.

How it works

  1. 1Run OpenCode in a Forkbench terminal. It reads Files with read_file where Forkbench has set up its tools, and with `fb file read` from the shell everywhere else.
  2. 2Add the document to Files and expose it to the thread: hold Option and drop it on the terminal, which does both and pastes its name.
  3. 3Ask the agent to read it by name. read_file returns Markdown, one heading per page, sheet or slide, 256 KB at a time, so a long document is paged rather than refused.
  4. 4Keep the original. get_file still saves the real file to disk when the agent has to work on it with a library.

Straight about the guarantee: OpenCode's attachment rules come from its documentation as of 25 November 2026 and may change.

Frequently asked

Related: Claude Code says "PDF too large", Giving an agent a document without putting it in the repo

Sources