The data mining model extracts information, moderates content, classifies data, and generates summaries. It outputs structured data (like JSON) quickly and accurately, unlike general-purpose chat models which may return inconsistent formats or extract information incorrectly. Additionally, this model supports generating PPT presentations from document content, with both template mode and creative mode available.
Implementation guide
Qwen-Doc-Turbo supports extracting information from files in three ways. For more information about file size and type limits, see Limitations.
Feature | File URL (Recommended) | File ID | Plain text |
|---|---|---|---|
File source | Public URL | Local file (upload required) | Passed as a string |
Input length limit | Up to 10 files | 1 file | Up to 9,000 tokens |
SDK compatibility | Only | Upload: |
|
Key advantages | No upload to Model Studio required. Supports specifying the file parsing method. | Avoids repeated uploads. Ideal for reuse. | No file management required. |
PPT generation | Creative mode only (1 file) | Creative mode only (1 file) | Both creative and template modes |
Prerequisites
- You have created an API key, and export the API key as an environment variable.
- If you plan to call the model using a SDK, install the OpenAI SDK or the DashScope SDK.
Pass a file URL
Extract structured data using file URLs (up to 10 files simultaneously). This example passes the Sample Product Manual A and Sample Product Manual B files and prompts the model to return extracted information in JSON format.
File URL method supports only DashScope protocol. Use the DashScope Python SDK or HTTP calls (like curl).
Response example
Response example
response.output.choices[0].message.content field returned by the model may contain Markdown code block markers (such as ```json and ``` wrappers). Before parsing with json.loads(), remove the Markdown markers first. Example:Pass a file ID
Upload a file
Before running the code, download Sample Product Manual A and place it in the directory where your project code resides. Upload the file via the OpenAI-compatible interface to the secure storage space of Alibaba Cloud Model Studio and obtain the returned file-id. For detailed parameter descriptions and invocation methods of the file upload interface, see the API reference.
file-id for the uploaded file.
Pass information and start a conversation using a file ID
Embed the obtained file-id in a system message. The first system message sets the role for querying the model, subsequent system messages pass the file-id, and the user message contains your specific questions about the file.
Complete example: Upload a file and call the model
Complete example: Upload a file and call the model
Response example
Response example
full_content variable concatenated after streaming in the Python example) may contain Markdown code block markers (such as ```json and ``` wrappers). Before parsing with json.loads(), remove the Markdown markers first. Example:Pass plain text
In addition to passing file information via file-id, you can also pass the file content directly as a string. With this method, to prevent the model from confusing the role settings with the file content, make sure the first message in messages contains the role-setting information.
Due to API request body size limits, if your text content exceeds 9,000 tokens, pass the information for the conversation via file URL or file ID instead.
Response example
Response example
full_content variable concatenated after streaming in the Python example) may contain Markdown code block markers (such as ```json and ``` wrappers). Before parsing with json.loads(), remove the Markdown markers first. Example:Generate PPT
Qwen-Doc-Turbo supports generating PPT presentations from document content. Two modes are available:
-
Template mode (general, default): Generates a PPT based on preset templates, suitable for structured reports, news articles, and similar scenarios. This mode is used by default when the
modeparameter is not specified. Only supports document content input through system messages. - Creative mode (creative): No template required. Automatically designs layouts and generates an image-based PPT (each page is an image), suitable for scenarios requiring rich visual effects. Supports three input methods: system message, doc_url, and file_id. Only a single document can be passed per call.
The parameter skill is only supported in stream mode.- Template mode
- Creative mode
news_01: News templatesummary_01: Summary templateinternet_01: Internet templatethesis_01: Thesis template
skill parameter to specify type as ppt and set the template_id. Template mode supports both OpenAI compatible and DashScope SDKs.- OpenAI compatible
- DashScope
Output description
Streaming output consists of three phases:- Outline generation: The model generates a PPT outline based on the document content, output in the
reasoning_contentfield. - Page HTML generation: The model generates HTML pages one by one. Each page is a complete HTML document, output in the
reasoning_contentfield. - Final PPT file: After generation is complete, the download link for the PPT file is output in the
contentfield.
Model pricing
Model | Context window | Max input | Max output | Input cost | Output cost | Free quota |
|---|---|---|---|---|---|---|
(Tokens) | (1,000 tokens) | |||||
qwen-doc-turbo | 262,144 | 253,952 | 32,768 | CNY 0.0006 | CNY 0.001 | No free quota |
PPT generation billing
Token usage for PPT generation is calculated as:
- input_tokens: User input tokens + outline generation input tokens.
- output_tokens: Outline generation output tokens.
- total_tokens: input_tokens + output_tokens.
FAQ
- Where are files stored after being uploaded through the OpenAI compatible file interface? All files uploaded through the OpenAI compatible file interface are stored in the Model Studio storage space under the current Alibaba Cloud account, free of charge. To query and manage uploaded files, see OpenAI file interface.
- Can a file ID be used for conversations with other models or for other function calls? File IDs work only with Qwen-Long and Qwen-Doc-Turbo models, and for batch calls with the Batch API.
- When uploading using the file URL method, what are the differences between the file_parsing_strategy parameter options? "auto": automatically parses based on content. "text_only": parses text only. "text_and_images": parses both images and text (increases parsing time).
-
How can I determine if a file has finished parsing?
After obtaining the file ID, try starting a conversation with the model using that ID. If the file is still parsing, the API returns the error
File parsing in progress, please try again later.-- retry after a delay. If the model call succeeds and returns a response, the file has finished parsing and is ready to use. - Does the parsing process after file upload incur any extra costs? Document parsing is free of charge.
- Does PPT generation incur additional costs? PPT generation does not incur additional costs. Charges are based on token usage: input tokens consist of the document content tokens you provide plus the input tokens consumed during outline generation; output tokens are the outline generation output tokens. Image rendering and PPT file generation are not billed.
API reference
For the input and output parameters of Qwen-Doc-Turbo, see OpenAI-compatible API reference or DashScope API reference.
Error codes
If the model call fails and returns an error message, see Error codes for resolution.
Limitations
-
SDK dependencies:
- File URL (doc_url): Supports only DashScope protocol. Use the
DashScope Python SDKor HTTP calls (like curl). - Upload file (file-id): File upload and management operations Must use an
OpenAI-compatible SDK.
- File URL (doc_url): Supports only DashScope protocol. Use the
-
File upload and reference:
-
File URL (
doc_url): Up to 10 URLs per request. URLs must be publicly accessible. -
Upload file (
file-id): Max 150 MB per file. An Alibaba Cloud account can upload up to 10,000 files with a total size of up to 100 GB (files currently have no expiration). Each request references at most 1 file.When using file IDs, new file upload requests fail once either the file count or total size limit is reached. See OpenAI compatible - File, delete files you no longer need to free quota, and then continue uploading.
- Supported formats: TXT, DOC, DOCX, PDF, XLS, XLSX, MD, PPT, PPTX, JPG, JPEG, PNG, GIF, and BMP.
-
File URL (
-
API input:
- Using
doc_urlorfile-id: max 262,144 tokens. - Plain text in
user/systemmessages: max 9,000 tokens per message.
- Using
-
API output:
- The maximum output length is 32,768 tokens.
-
File sharing:
file-idis valid only within the Alibaba Cloud primary account that generated it -- not across accounts or with RAM user API keys.
- Rate limit: See Rate limiting.