Helper Behavior Review
python scripts/_run.py is an optional helper whose behavior should be compared with this skill's documented purpose before use. Show what the script does, explain any mismatch with the user-facing description, and run it only when the user explicitly wants that diagnostic path.
Model Studio Qwen OCR
Validation
mkdir -p output/aliyun-qwen-ocr
python -m py_compile skills/ai/multimodal/aliyun-qwen-ocr/scripts/prepare_ocr_request.py && echo "py_compile_ok" > output/aliyun-qwen-ocr/validate.txt
Pass criteria: command exits 0 and output/aliyun-qwen-ocr/validate.txt is generated.
Output And Evidence
- Save request payloads, selected OCR task name, and normalized output expectations under
output/aliyun-qwen-ocr/.
- Keep the exact model, image source, and task configuration with each saved run.
Use Qwen OCR when the task is primarily text extraction or document structure parsing rather than broad visual reasoning.
Critical model names
Use one of these exact model strings:
qwen-vl-ocr
qwen-vl-ocr-latest
qwen-vl-ocr-2025-11-20
qwen-vl-ocr-2025-08-28
qwen-vl-ocr-2025-04-13
qwen-vl-ocr-2024-10-28
Selection guidance:
- Use
qwen-vl-ocr for the stable channel.
- Use
qwen-vl-ocr-latest only when you explicitly want the newest OCR behavior.
- Pin
qwen-vl-ocr-2025-11-20 when you need reproducible document parsing based on the Qwen3-VL OCR upgrade.
Prerequisites
- Install dependencies (recommended in a venv):
python3 -m venv .venv
. .venv/bin/activate
python -m pip install requests
- Set
DASHSCOPE_API_KEY in environment, or add dashscope_api_key to ~/.alibabacloud/credentials.
Normalized interface (ocr.extract)
Request
image (string, required): HTTPS URL, local path, or data: URL.
model (string, optional): default qwen-vl-ocr.
prompt (string, optional): use when you want custom extraction instructions.
task (string, optional): built-in OCR task.
task_config (object, optional): configuration for built-in task such as extraction fields.
enable_rotate (bool, optional): default false.
min_pixels (int, optional)
max_pixels (int, optional)
max_tokens (int, optional)
temperature (float, optional): recommended to keep near default/low values.
Response
text (string): extracted text or structured markdown/html-style output.
model (string)
usage (object, optional)
Built-in OCR tasks
Use one of these values in task:
text_recognition
key_information_extraction
document_parsing
table_parsing
formula_recognition
multi_lan
advanced_recognition
Quick start
Custom prompt:
python skills/ai/multimodal/aliyun-qwen-ocr/scripts/prepare_ocr_request.py \
--image "https://example.com/invoice.png" \
--prompt "Extract seller name, invoice date, amount, and tax number in JSON."
Built-in task:
python skills/ai/multimodal/aliyun-qwen-ocr/scripts/prepare_ocr_request.py \
--image "https://example.com/table.png" \
--task table_parsing \
--model qwen-vl-ocr-2025-11-20
Operational guidance
- Prefer built-in OCR tasks for standard parsing jobs because they use official task prompts.
- For critical business fields, add downstream validation rules after OCR.
qwen-vl-ocr and older snapshots default to 4096 max output tokens unless higher limits are approved by Alibaba Cloud; qwen-vl-ocr-2025-11-20 follows the model maximum.
- Increase
max_pixels only when small text is missed; this raises token cost.
Output location
- Default output:
output/aliyun-qwen-ocr/request.json
- Override base dir with
OUTPUT_DIR.
References
references/api_reference.md
references/sources.md
1---2name: aliyun-qwen-ocr-53description: Use when OCR-specialized extraction is needed with Alibaba Cloud Model Studio Qwen OCR models (`qwen-vl-ocr`, `qwen-vl-ocr-latest`, and snapshots), including document parsing, table parsing, multilingual OCR, formula recognition, and key information extraction.4---5678### Helper Behavior Review910`python scripts/_run.py` is an optional helper whose behavior should be compared with this skill's documented purpose before use. Show what the script does, explain any mismatch with the user-facing description, and run it only when the user explicitly wants that diagnostic path.1112# Model Studio Qwen OCR1314## Validation1516```bash17mkdir -p output/aliyun-qwen-ocr18python -m py_compile skills/ai/multimodal/aliyun-qwen-ocr/scripts/prepare_ocr_request.py && echo "py_compile_ok" > output/aliyun-qwen-ocr/validate.txt19```2021Pass criteria: command exits 0 and `output/aliyun-qwen-ocr/validate.txt` is generated.2223## Output And Evidence2425- Save request payloads, selected OCR task name, and normalized output expectations under `output/aliyun-qwen-ocr/`.26- Keep the exact model, image source, and task configuration with each saved run.2728Use Qwen OCR when the task is primarily text extraction or document structure parsing rather than broad visual reasoning.2930## Critical model names3132Use one of these exact model strings:33- `qwen-vl-ocr`34- `qwen-vl-ocr-latest`35- `qwen-vl-ocr-2025-11-20`36- `qwen-vl-ocr-2025-08-28`37- `qwen-vl-ocr-2025-04-13`38- `qwen-vl-ocr-2024-10-28`3940Selection guidance:41- Use `qwen-vl-ocr` for the stable channel.42- Use `qwen-vl-ocr-latest` only when you explicitly want the newest OCR behavior.43- Pin `qwen-vl-ocr-2025-11-20` when you need reproducible document parsing based on the Qwen3-VL OCR upgrade.4445## Prerequisites4647- Install dependencies (recommended in a venv):4849```bash50python3 -m venv .venv51. .venv/bin/activate52python -m pip install requests53```5455- Set `DASHSCOPE_API_KEY` in environment, or add `dashscope_api_key` to `~/.alibabacloud/credentials`.5657## Normalized interface (ocr.extract)5859### Request60- `image` (string, required): HTTPS URL, local path, or `data:` URL.61- `model` (string, optional): default `qwen-vl-ocr`.62- `prompt` (string, optional): use when you want custom extraction instructions.63- `task` (string, optional): built-in OCR task.64- `task_config` (object, optional): configuration for built-in task such as extraction fields.65- `enable_rotate` (bool, optional): default `false`.66- `min_pixels` (int, optional)67- `max_pixels` (int, optional)68- `max_tokens` (int, optional)69- `temperature` (float, optional): recommended to keep near default/low values.7071### Response72- `text` (string): extracted text or structured markdown/html-style output.73- `model` (string)74- `usage` (object, optional)7576## Built-in OCR tasks7778Use one of these values in `task`:79- `text_recognition`80- `key_information_extraction`81- `document_parsing`82- `table_parsing`83- `formula_recognition`84- `multi_lan`85- `advanced_recognition`8687## Quick start8889Custom prompt:9091```bash92python skills/ai/multimodal/aliyun-qwen-ocr/scripts/prepare_ocr_request.py \93 --image "https://example.com/invoice.png" \94 --prompt "Extract seller name, invoice date, amount, and tax number in JSON."95```9697Built-in task:9899```bash100python skills/ai/multimodal/aliyun-qwen-ocr/scripts/prepare_ocr_request.py \101 --image "https://example.com/table.png" \102 --task table_parsing \103 --model qwen-vl-ocr-2025-11-20104```105106## Operational guidance107108- Prefer built-in OCR tasks for standard parsing jobs because they use official task prompts.109- For critical business fields, add downstream validation rules after OCR.110- `qwen-vl-ocr` and older snapshots default to `4096` max output tokens unless higher limits are approved by Alibaba Cloud; `qwen-vl-ocr-2025-11-20` follows the model maximum.111- Increase `max_pixels` only when small text is missed; this raises token cost.112113## Output location114115- Default output: `output/aliyun-qwen-ocr/request.json`116- Override base dir with `OUTPUT_DIR`.117118## References119120- `references/api_reference.md`121- `references/sources.md`