PDF Understanding enables the model to parse and comprehend PDF documents, extracting text and images for analysis. You can pass PDF files via URL or Base64 encoding.
PDF understanding is currently available only in China (Beijing), and calls via the Responses API are not supported at this time. If you pass a PDF using the Responses API, the call still returns HTTP 200, but the file is not delivered to the model.
Supported Models
qwen3.8-max, qwen3.8-flash, qwen3.8-27b
Quick Start
The following examples demonstrate how to send a PDF file to the model.
You must have Obtain an API key and completed Configure API key as an environment variable.
- OpenAI Compatible
- DashScope
- Python
- Node.js
- HTTP
Sample Code
Using Base64 Input
If you cannot provide a URL, you can pass the PDF file as a Base64-encoded string. The filename field is required when using file_data.
Request Parameters
The file input is specified as a content item with type: "file" (OpenAI-compatible) or as a content item containing file_url/file_data (DashScope).
Parameter | Type | Required | Description |
|---|---|---|---|
file_url | string | Conditional | URL of the PDF file to download. Mutually exclusive with |
file_data | string | Conditional | Base64-encoded PDF data in the format |
filename | string | Conditional | The file name. Required when using |
file_format | string | No | The file format. Currently only |
Limits
Item | Limit |
|---|---|
Maximum file size | 150 MB |
Maximum page count | 500 pages |
Billing
Billing involves the following:
- Model input tokens: Text extracted from the PDF and images parsed from pages are counted as input tokens, billed at the model's standard input token rate.
- Document parsing fee: Charged per page of the PDF document parsed, corresponding to the metering item document_parsing (pdf).China (Beijing): $0.00275 per page.