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.
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 batch calls. | Avoids repeated uploads. Ideal for reuse. | No file management required. |
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).
content field. Note that the content may be wrapped in markdown code block markers (for example, ```json\n[...]\n```). You need to strip these markdown markers before parsing the response with json.loads():Response example
Response example
Pass a file ID
Upload a file
Before running the code, download Sample Product Manual A and place it in your project directory. Upload the file via the OpenAI-compatible interface to get a file-id. For upload API details, see the API reference.
file-id for the uploaded file.
Pass information and start a conversation using a file ID
Pass the file-id in a system message (after the role-setting message). The user message contains your query about the file.
Complete example: Upload a file and call the model
Complete example: Upload a file and call the model
content field. Note that the content may be wrapped in markdown code block markers (for example, ```json\n[...]\n```). You need to strip these markdown markers before parsing the response with json.loads():Example response
Example response
Pass plain text
You can pass file content directly as a string instead of using a file-id. To prevent confusion, put the role-setting message first in the messages array.
If text content exceeds 9,000 tokens, use a file URL or file ID instead (due to API body size limits).
content field. Note that the content may be wrapped in markdown code block markers (for example, ```json\n[...]\n```). You need to strip these markdown markers before parsing the response with json.loads():Response example
Response example
Model pricing
Model | Context window | Max input | Max output | Input cost | Output cost | Free quota |
|---|---|---|---|---|---|---|
(Tokens) | (Million tokens) | |||||
qwen-doc-turbo | 262,144 | 253,952 | 32,768 | $0.087 | $0.144 | No free quota |
FAQ
- Where are files stored after being uploaded through the OpenAI compatible file interface? Files uploaded via the OpenAI-compatible interface are stored free in your Model Studio bucket. To query and manage files, see OpenAI file interface.
- 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?
Try starting a conversation with the file ID. If the file is still parsing, the API returns
File parsing in progress, please try again later.-- retry after a delay. If the call succeeds, the file is ready. - Does the parsing process after file upload incur any extra costs? Document parsing is free of charge.
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): Must use an
OpenAI-compatible SDK for upload and management.
- 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. Account limits: 10,000 files or 100 GB total (files never expire). Each request references one file only.Upload requests fail when limits are reached. Delete unneeded files to free quota. See OpenAI compatible - File for details.
- 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-idworks only within the generating account -- not across accounts or with RAM user API keys.
- Rate limit: See Rate limiting.