Supported models
Currently, only Gemini chat models, GLM vision models, and Doubao Seed chat models natively support chatting with PDFs. These include:gemini-4-carbongemini-4-argongemini-3.8-flashgemini-3.6-flashgemini-3.5-flash-litegemini-3.5-flashgemini-3.1-pro-previewgemini-3.1-pro-preview:fast-thinkinggemini-3.1-flash-lite-previewgemini-3-flash-previewgemini-3-flash-preview:no-thinkinggemini-2.5-progemini-2.5-pro:fast-thinkinggemini-2.5-flashgemini-2.5-flash:no-thinkinggemini-2.5-flash-litegemini-2.5-flash-lite:no-thinkingmuse-spark-1.3muse-spark-1.3-contributormuse-spark-1.2muse-spark-1.2-contributorglm-5.3-flashxglm-5.3-flashdoubao-seed-evolvingdoubao-seed-2.1-turbodoubao-seed-2.1-prodoubao-seed-2.0-minidoubao-seed-2.0-litedoubao-seed-2.0-prodoubao-seed-2.0-code
- 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
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.Chat with plain-text files
In addition to PDFs, Gemini vision models support these plain-text formats:- JavaScript: set
mime_typetotext/javascript. - Python: set
mime_typetotext/x-python. - TXT: set
mime_typetotext/plain. - HTML: set
mime_typetotext/html. - CSS: set
mime_typetotext/css. - Markdown: set
mime_typetotext/markdown. - CSV: set
mime_typetotext/csv. - XML: set
mime_typetotext/xml. - RTF: set
mime_typetotext/rtf.
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-flashxglm-5.3-flash
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
uuid field in the response uniquely identifies the file. Use it with the file read endpoint to retrieve the contents:
curl
status is done, the content field contains the PDF text.
Chat with the model
Pass the extracted PDF text as chat context:
curl
