Vision Models
Qwen vision-language models for image understanding, document analysis, and visual Q&A.
Vision Models
The Qwen VL (Vision-Language) models understand images, documents, charts, and screenshots alongside text. They're built on the same architecture as the text models and accessed through the same OpenAI-compatible API.
Models
Image tokens are counted as part of the input token total. A typical 1024×1024 image uses roughly 1,000–1,500 tokens depending on detail level.Capabilities
- Natural images — scene understanding, object detection, visual Q&A
- Documents and PDFs — extract text, tables, and structure from scanned or rendered pages
- Charts and graphs — interpret bar charts, line graphs, pie charts, and data tables
- Screenshots and UIs — describe UI elements, read text, identify layout
- Multi-image reasoning — compare or analyze multiple images in one request
Quickstart
Pass images as base64 or public URLs in the image_url content part:
``python
from openai import OpenAI
import base64
client = OpenAI(
api_key="YOUR_QWENAPI_KEY",
base_url="https://dashscope-intl.aliyuncs.com/compatible-mode/v1",
)
Using a public URL
response = client.chat.completions.create(
model="qwen-vl-max",
messages=[
{
"role": "user",
"content": [
{"type": "image_url", "image_url": {"url": "https://example.com/chart.png"}},
{"type": "text", "text": "Summarize the key trends in this chart."},
],
}
],
)
print(response.choices[0].message.content)
`
Base64 Image Input
`python
with open("document.png", "rb") as f:
image_data = base64.b64encode(f.read()).decode()
response = client.chat.completions.create(
model="qwen-vl-max",
messages=[
{
"role": "user",
"content": [
{
"type": "image_url",
"image_url": {"url": f"data:image/png;base64,{image_data}"},
},
{"type": "text", "text": "Extract all text from this document."},
],
}
],
)
`
Multiple Images
`python
response = client.chat.completions.create(
model="qwen-vl-max",
messages=[
{
"role": "user",
"content": [
{"type": "image_url", "image_url": {"url": "https://example.com/before.png"}},
{"type": "image_url", "image_url": {"url": "https://example.com/after.png"}},
{"type": "text", "text": "What changed between these two screenshots?"},
],
}
],
)
`
Supported Image Formats
JPEG, PNG, GIF (first frame), WebP, BMP. Maximum image size: 20 MB per image. Up to 20 images per request.
Choosing Between VL-Max and VL-Plus
Use qwen-vl-max when accuracy is critical: complex document extraction, detailed chart analysis, multi-image comparison, or production pipelines where errors are costly.
Use qwen-vl-plus for high-volume, lower-stakes tasks: image classification, simple captioning, thumbnail descriptions, or when you're optimizing for cost.
Document Processing Example
`python
Extract structured data from an invoice
response = client.chat.completions.create(
model="qwen-vl-max",
messages=[
{
"role": "user",
"content": [
{"type": "image_url", "image_url": {"url": invoice_url}},
{
"type": "text",
"text": "Extract vendor name, invoice number, date, line items, and total. Return as JSON.",
},
],
}
],
response_format={"type": "json_object"},
)
``