Skip to main content

Supported models

Currently, only Gemini chat models, GLM vision models, and Doubao Seed chat models natively support chatting with PDFs. These include:
  • gemini-4-carbon
  • gemini-4-argon
  • gemini-3.8-flash
  • gemini-3.6-flash
  • gemini-3.5-flash-lite
  • gemini-3.5-flash
  • gemini-3.1-pro-preview
  • gemini-3.1-pro-preview:fast-thinking
  • gemini-3.1-flash-lite-preview
  • gemini-3-flash-preview
  • gemini-3-flash-preview:no-thinking
  • gemini-2.5-pro
  • gemini-2.5-pro:fast-thinking
  • gemini-2.5-flash
  • gemini-2.5-flash:no-thinking
  • gemini-2.5-flash-lite
  • gemini-2.5-flash-lite:no-thinking
  • muse-spark-1.3
  • muse-spark-1.3-contributor
  • muse-spark-1.2
  • muse-spark-1.2-contributor
  • glm-5.3-flashx
  • glm-5.3-flash
  • doubao-seed-evolving
  • doubao-seed-2.1-turbo
  • doubao-seed-2.1-pro
  • doubao-seed-2.0-mini
  • doubao-seed-2.0-lite
  • doubao-seed-2.0-pro
  • doubao-seed-2.0-code
For example, Gemini uses its vision capabilities to understand a PDF in context, rather than just extracting text. It can:
  • Analyze and interpret text, images, charts, and tables in documents up to 1,000 pages long
  • Extract information into a structured output format
  • Summarize and answer questions using both visual and textual elements
  • Transcribe documents (for example, into HTML) while preserving their layout and formatting for downstream applications

Chat with PDFs

One file Send a request with a single PDF:
curl
Multiple files As with images, you can chat about multiple PDFs. Add a separate file_url object to the content list for each PDF:
curl
Only Gemini models require the mime_type field to specify the file type. Omit it for other models.
Gemini does not limit the number of PDFs, but the combined page count must not exceed 1,000.

Chat with plain-text files

In addition to PDFs, Gemini vision models support these plain-text formats:
  • JavaScript: set mime_type to text/javascript.
  • Python: set mime_type to text/x-python.
  • TXT: set mime_type to text/plain.
  • HTML: set mime_type to text/html.
  • CSS: set mime_type to text/css.
  • Markdown: set mime_type to text/markdown.
  • CSV: set mime_type to text/csv.
  • XML: set mime_type to text/xml.
  • RTF: set mime_type to text/rtf.
For example, a Markdown request has the same structure as a PDF request. Replace url and set mime_type to text/markdown:
curl

Chat with Office files

Only certain GLM vision models natively support Office documents (Word, Excel, and PowerPoint):
  • glm-5.3-flashx
  • glm-5.3-flash
Use the same request structure as for a PDF, replacing mime_type with the corresponding Office file type:
curl

Other models

If a model cannot chat with files or does not support your file format, use the file upload and file read endpoints to extract the contents. Then pass them as chat context. This API supports PDFs, Office documents, plain text, and other formats. The example below uses DeepSeek-V4-Flash with a PDF. Prepare the file Upload the PDF using the file upload endpoint to get its ID:
curl
The uuid field in the response uniquely identifies the file. Use it with the file read endpoint to retrieve the contents:
curl
When status is done, the content field contains the PDF text. Chat with the model Pass the extracted PDF text as chat context:
curl