Draft

Use Qwen4-Max to Understand One Image and One Short Video on the Beijing Free Quota

  • Not yet verified
  • Versions not pinned
  • 15 min read

Task

What you will complete

Call qwen4-max on Alibaba Model Studio in Beijing to understand one original diagram and one short original video on that model's 1,000,000-token free grant, with 免费额度用完即停 / Free Quota Only turned on, then check the answers against the fixture contract without trusting fluent prose.

Success criteria

  • understand_fixtures.py sends one image call and one short-video call to qwen4-max on the Beijing host, using the original fixtures in examples/fixtures/.
  • Each response is checked against the fixture contract in examples/fixtures/expected.json, without treating fluent prose as success.
  • Usage from each call is kept, including any image or video token breakdown the service actually returns. The local image-token estimate is a formula result, not a substitute for that usage object.

What this is not

Not an image-generation or image-edit guide (that belongs on qwen-image-3.0), not a VL model-card recap, and not a path that understands a video's audio track, accepts a PDF as a document upload, or runs batch inference. Output is text.

Prerequisites

  • A China-site (aliyun.com) Beijing Model Studio key and workspace ID, with a remaining qwen4-max grant and 免费额度用完即停 turned on for that model.
  • The original fixtures shipped with this tutorial (one diagram and one short, silent video).
  • Python and the official openai package. The scripts should not be pointed at a Token Plan host, a Singapore region key, or qwen4-max-preview.

Environment

DASHSCOPE_API_KEY
Beijing Model Studio API key
DASHSCOPE_WORKSPACE_ID
Workspace ID used to build the recommended Beijing host, unless DASHSCOPE_BASE_URL is set
DASHSCOPE_BASE_URL
Optional full OpenAI-compatible base URL, e.g. https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/compatible-mode/v1
QWEN_MODEL
qwen4-max

Qwen4-Max can read a picture and a short video on the same China (Beijing) Model Studio key you would use for text. It answers in text. It does not draw a new image, and it does not listen to a soundtrack. This walkthrough sends one original labeled diagram and one original six-second status clip to qwen4-max, asks for fields you can check by looking at the files, and keeps both calls on that model’s own 90-day 1,000,000-token Beijing grant.

Contract What the official pages say, read 2026-11-17 (Asia/Shanghai)
Model ID qwen4-max. You do not switch to a VL-only ID just because the input is visual.
Where Alibaba Cloud China site (aliyun.com), 实名认证, 华北2 / China (Beijing) Model Studio.
Grant A 1,000,000-token Beijing allowance, input and output in one pool, not shared with other models. The model was listed on 2026-11-16. If the account was already open that day, 90 days later is 2027-02-14. The date in the console is the one that counts.
Spend stop Turn on 免费额度用完即停 (English docs: Free Quota Only). It is off by default. Leave it off, and an exhausted grant flips to the Beijing list price of CNY 10 / 30 per million input / output tokens. Turn it on, and the documented result past the grant is HTTP 403 with the error code AllocationQuota.FreeTierOnly.
How the media travel OpenAI-compatible Chat Completions: an image_url part for the picture, a video_url part for the clip, plus a text instruction. This draft uses Base64 data URLs so nothing has to be on a public host.
What comes back Text only. Image and video tokens count as input against the grant. Thinking tokens, if any, count as output.

The limits, prices, request shapes, and token formulas in the rest of this page were taken from official Model Studio documentation opened on 2026-11-17 (Asia/Shanghai). These two fixtures have not been sent to qwen4-max from this site. You will not find an API transcript here, or a latency number, or a token count the service itself returned.

The fixture calls have not been sent yet

Scripts and media sit in examples/ beside this tutorial. python -m py_compile accepted every Python file. The image-token estimator was executed on the local diagram; that run only applies the published formula, it does not call a model. understand_fixtures.py --dry-run prints the planned request shape and stops. Nothing below that line is a captured response.

If a response field appears only because a documentation page names it, the text says that. It is not a field this site has seen come back from qwen4-max. A later verified revision should add the run date, package versions, the usage objects, and whether the local checker passed.

Why is the model ID still qwen4-max, not a VL name?

Because the official text generation and visual understanding guide treats Plus, Max, and Flash as models that already accept text, images, and video and reply in text. It says you do not need to switch to a VL model only because the input contains a picture or a clip. The qwen4-max model page lists those same input modalities in every region it publishes, including 华北2 (Beijing), and lists the output modality as text.

That is the distinction from the image-generation tutorial in this series, which calls qwen-image-3.0 and spends a 10-image grant. This job never asks qwen4-max to produce pixels. If you need a new picture, this is the wrong model.

The same model page also lists thinking, function calling, structured output, and web search as supported capabilities. Those are optional here. The planned script turns thinking off and does not send tools, so the grant is spent on reading the fixtures rather than on a default reasoning pass.

What fixtures make the answers checkable without trusting the model?

Two original files, generated for this draft, plus a ground-truth JSON file. They contain no photographs, no real faces, and no copied product UI. You can regenerate them with python fixtures/make_fixtures.py if you have Pillow and ffmpeg.

Fixture A is fixture-a-lab-panel.png, a 960×540 labeled diagram titled FIXTURE-A LAB PANEL, ID AR-VISION-2026-11-17, revision R3. Four colored boxes run left to right: INLET / PORT 7 (blue), FILTER / MESH 40 (amber), PUMP / 1.2 L/min (green), OUTLET / OPEN (red). The planned prompt asks the model for those fields as JSON.

Fixture B is fixture-b-status-panel.mp4, a 6.0-second, 640×360, 10 fps H.264 clip with no audio track (21,074 bytes). The panel is titled FIXTURE-B STATUS PANEL, ID AR-VIDEO-2026-11-17. It holds IDLE and queue 3 for two seconds, RUNNING and queue 1 for two seconds, then DONE, queue 0, and the banner BATCH 42 COMPLETE. The planned prompt asks for that sequence.

fixtures/expected.json is the scorecard. After a live response, understand_fixtures.py compares selected JSON fields with that file in ordinary Python. A pass or fail from that checker is evidence. A fluent caption, on its own, is not.

Official sample photographs, including the beach scene used in the vision quick start, are not part of this check. They are someone else’s media, and they are harder to score than a diagram you can read in a few seconds.

How should a Beijing request carry the image and the video?

Use a regular Model Studio key from the Beijing console, not a Token Plan key. Official new-user quota rules say a Token Plan key does not draw from the free grant. Point the OpenAI SDK at the workspace host documented for 华北2:

https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/compatible-mode/v1

Copy {WorkspaceId} from 业务空间详情. Official OpenAI-compatible Chat docs still mention https://dashscope.aliyuncs.com/compatible-mode/v1 as a working Beijing path, and they recommend moving that traffic to the workspace host.

The vision guide shows the content parts. For a picture, type is image_url, and the URL sits in image_url.url. For a video file, type is video_url, and the URL sits in video_url.url. The fps field is a sibling of video_url, not a key inside it. Documented range is 0.1 to 10; the documented default is 2.0. max_frames is documented only for the DashScope SDK, so the planned OpenAI-compatible call does not send it.

This draft uses two requests, not one combined payload. Official pages show multi-image arrays and separate video examples. They do not, in the pages opened for this article, show a single worked request that mixes one image file and one video file. Two calls keep the usage objects and the checker results apart.

The planned image content looks like this. The URL in a live run is a data URL built from the local PNG; it is not shown in full here.

{
    "role": "user",
    "content": [
        {
            "type": "image_url",
            "image_url": {
                "url": "data:image/png;base64,...",
                "detail": "low",
            },
        },
        {"type": "text", "text": IMAGE_PROMPT},
    ],
}

The planned video content:

{
    "role": "user",
    "content": [
        {
            "type": "video_url",
            "video_url": {"url": "data:video/mp4;base64,..."},
            "fps": 2,
        },
        {"type": "text", "text": VIDEO_PROMPT},
    ],
}

Both calls set extra_body={"enable_thinking": False} and model="qwen4-max". The script also raises the OpenAI client’s timeout to 1,800 seconds, following the vision guide’s warning that a large visual request can outlive the SDK default even when the service-side window is longer.

A caution about the English OpenAI-compatible vision overview, re-fetched on 2026-11-17: the upper base-URL list correctly gives China (Beijing) as https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/compatible-mode/v1, but the HTTP endpoint list later on the same page still prints Beijing as https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1. Do not send a Beijing key to that Singapore host. The Chinese pages and the same English page’s earlier list are the ones to follow.

If the files live only on your machine, which input path do you use?

Official docs describe three ways to get media into the model: a public HTTP or HTTPS URL, a Base64 data URL, and a local filesystem path.

The path option is only for the DashScope Python and Java SDKs. It is not supported on DashScope HTTP or on the OpenAI-compatible interface this script uses.

A public URL must be reachable from Model Studio, must not be an OSS internal endpoint (a host that contains -internal), and must return both Content-Length and Content-Type. Missing either header is documented to fail the download. If you do not already have a public object, Model Studio will store a temporary oss:// URL for you. The temporary file URL page says that object is free, bound to the model name you upload under, bound to the same Alibaba Cloud primary account, and deleted after 48 hours. HTTP calls that use the oss:// URL must send the header X-DashScope-OssResourceResolve: enable. The DashScope SDK is documented to add that header itself. The same page says the upload is not for production or load tests.

For these fixtures, Base64 is the simpler contract. The vision FAQ recommends it for images and videos whose original size is under 7 MB when you are on the OpenAI-compatible path, because the service does not have to fetch the file. The limits that matter for qwen4-max on that path, from the Chinese vision page, are:

  • Image, Base64: original file up to 20 MB; the data URI itself up to 20 MB on OpenAI-compatible and DashScope calls (32 MB on Anthropic-compatible).
  • Video, Base64: the encoded string must be under 10 MB.
  • The whole request body must stay under 64 MB. Official docs give the older DashScope domain a 16 MiB body cap and recommend the workspace host instead.

Fixture A is 27,890 bytes. Fixture B is 21,074 bytes. Both sit well under every published Base64 cap, which is why the script encodes them directly.

If you later send a public URL instead, keep the six-second clip. The model-selection table gives qwen4-max a maximum video duration of 2 hours and a maximum video size of 2 GB, and a maximum of 64 videos per request. The vision page’s own video-file bullets are less tidy: they name the qwen3.8 / 3.7 / 3.6 / 3.5 series for the 2 GB / 2 hour band, and they put “other models” at 150 MB and 2–40 seconds, without naming qwen4-max in those two lists. This page does not pretend that wording is settled. A six-second, 21 KB MP4 is inside every band those pages publish.

How hard do these two calls hit the 1,000,000-token grant?

Harder than the text you type, and easier to underestimate if you leave the defaults alone.

The vision billing section is clear on the composition. Input tokens are text tokens plus the tokens the service derives from each image or video. Output tokens are the model’s text. In thinking mode, the reasoning also counts as output. The 1,000,000-token Beijing grant is a single pool for input and output. The new-user quota page says the remainder you see in the console is that shared total.

For a still image, the official formula is:

image tokens = h_bar × w_bar / token_pixels + 2

For qwen4-max, each image token corresponds to 32×32 pixels, the extra 2 tokens are the vision begin and end markers, and the minimum pixel count is 65,536. Before that arithmetic, the model resizes the image. If you do not send max_pixels, detail=high (the documented default for qwen4-max) uses the original resolution up to 16,777,216 pixels; detail=low and detail=auto cap at 2,621,440. An explicit max_pixels wins over detail, with the same 16,777,216 ceiling. Chat Completions accepts detail inside image_url or as a sibling of image_url.

On 2026-11-17 (Asia/Shanghai), estimate_image_tokens.py was run locally against Fixture A with that formula. At 960×540, the resized size is 544×960 for both detail=high and detail=low, because the diagram is under both caps. The estimate is 512 image tokens either way, plus whatever the prompt text adds. That number is a formula result, not a usage value from the API. The planned script still sets detail=low so a later, denser photograph does not silently climb toward the 16-million-pixel cap.

Video tokens are a different story. The service extracts frames (default fps=2), then bills the frames as visual tokens. The official estimator on the vision page is labeled as a Qwen3-VL-Plus parameter set: it is useful as a method, and it is not a qwen4-max tariff. This draft therefore does not publish a video-token number for Fixture B. After a live call, read usage on the response. Some official examples also break out image_tokens under the usage object; treat any similar video breakdown you see as documented or observed only when it actually appears.

Two other defaults spend the grant faster than the fixtures themselves. Thinking is on by default for qwen4-max (enable_thinking true, reasoning_effort high). The planned script turns thinking off. A higher fps pulls more frames from the same clip; leave it at 2 unless the motion is actually fast. And a long, high-resolution source file does not automatically improve understanding — official video-limit notes say the model will resize frames anyway.

Once the grant is gone, the Beijing list price on the model page and the pricing page is CNY 10 per million input tokens and CNY 30 per million output tokens, thinking included in the output price, for requests whose input is at most 1 million tokens. That is a price, not a prompt to top up. With 用完即停 on, the documented result is a refusal.

Should thinking stay on, and can tools ride along?

For this check, no. Leave thinking off unless you have a reason to pay for a reasoning trace you are not going to score.

The vision guide demonstrates thinking with an image on qwen4-max: enable_thinking goes in extra_body for the official OpenAI Python SDK, and the example streams the reasoning. The qwen4-max defaults are thinking on, reasoning_effort=high, and thinking_budget=131072. If you do turn thinking back on, stream the response so a long trace is less likely to trip a client timeout.

Tools are a separate question. The model card lists function calling as supported, and the official Function Calling page includes a qwen4-max example that sends an image, sets enable_thinking to true, and passes tools in the same request. So the documented position is that thinking, tools, and an image can appear together. This article did not find a complete official walkthrough that does the same thing with a video file. The planned fixture job does not send tools at all. If you add some later, keep the local checker; a tool call is not a substitute for reading the panel.

What will qwen4-max not do with this media?

It will not generate or edit an image. Output is text. A product shot or a color change belongs on qwen-image-3.0, which has a different grant and a different endpoint, covered earlier in this series.

It will not understand the audio track of a video. The vision limits say so directly. Fixture B is silent on purpose. If the fact you need is only spoken, this API will not hear it.

It will not take a PDF, Word, or plain-text file as a document upload on the vision path. Official guidance is to rasterize pages into images, or to use a document model such as Qwen-Long. Do not send a .pdf URL in image_url and hope.

It will not raise the published media caps if you buy a higher plan. Image and video limits are tied to the model. For qwen4-max still images, the Chinese vision page allows up to 2,048 public-URL or local-path images, or 250 Base64 images, subject also to the model’s maximum input tokens; a video supplied as a frame list is tighter (4 to 80 frames for Qwen4-Max). Minimum still-image size is more than 10 pixels on each side, with a 200:1 aspect-ratio cap. Preferred formats include JPEG, PNG, WebP, BMP, TIFF, and HEIC; between 4K and 8K, only JPEG and PNG are listed.

It will not run batch inference. The qwen4-max model page lists batch, fine-tuning, and deployment as unsupported. The vision guide’s 50 percent batch discount applies to models that actually offer that path.

And it will not keep spending the free grant if you have turned 用完即停 on and the million tokens are gone. That refusal is the point of the switch.

What still has to be captured from a live image and video call

The missing evidence is a Beijing Model Studio key, a workspace ID, and 免费额度用完即停 enabled for qwen4-max, then a run of understand_fixtures.py on these two fixtures. Keep the full terminal output, the openai package version, the Python version, and a timestamp in Asia/Shanghai. Keep the usage object from each call, including any image or video token breakdown the service actually returns, plus the checker result and the raw model JSON if the checker fails. Those artifacts are what would make this page verified. They are not here yet.

You can run that script from a terminal in mainland China, or ask a coding assistant such as Codex or Grok Bot to run it there once the key is in the environment. The script should not be pointed at a Token Plan host, a Singapore region key, or qwen4-max-preview.

Sources

Each link below was opened on 2026-11-17, Asia/Shanghai:

  • 图像与视频理解 and the English vision guide: image_url and video_url request shapes, fps range and default, max_frames on DashScope only, thinking examples, Base64 and local-path rules, image and video limits, the image-token formula and qwen4-max pixel rules, the Qwen3-VL-Plus-labeled video estimator, billing composition, and the audio-track limitation.
  • 文本生成与视觉理解: quality-first recommendation of qwen4-max, and the parameter table that lists 16M pixels per image, 2 hours, 2 GB, 2,048 images, and 64 videos.
  • qwen4-max 模型页 and the English model page: input and output modalities, thinking defaults, Beijing list prices CNY 10 / 30, the 1,000,000-token free allowance, rate limits, and no batch, fine-tuning, or deployment.
  • OpenAI兼容-Chat: the Beijing workspace host, the still-usable DashScope host, and enable_thinking via extra_body.
  • OpenAI-compatible - Vision: the English Beijing base URL, and the HTTP endpoint typo that still lists Beijing as ap-southeast-1.
  • 上传本地文件获取临时URL: 48-hour oss:// URLs, model and account binding, and X-DashScope-OssResourceResolve: enable.
  • 新人免费额度: free allowances only for Beijing models on the China site; 90-day validity; separate pools per model; 实名认证 required; 用完即停 defaults to off; exhausted calls with the switch on return HTTP 403 / AllocationQuota.FreeTierOnly.
  • 模型调用价格: Beijing list prices for qwen4-max.
  • Function Calling: a qwen4-max example that combines an image, thinking, and tools.
  • 模型上架与更新: qwen4-max listed on 2026-11-16.

Third-party pages were opened for search context, not as a source of limits:

Earlier tutorials in this series cover a text tool-calling job, a hosted 27B call, Qwen Image 3.0 generation, a three-model quota comparison, and switching an existing OpenAI client. You can follow the two calls here without opening those pages, and none of their example programs are used in this draft.


Title tag: Use Qwen4-Max to Understand One Image and One Short Video

Meta description: Call qwen4-max on Alibaba Model Studio in Beijing to read one original diagram and one short original video on that model’s 1,000,000-token free grant. Official request shapes and token rules; not yet run on a live key.

Slug: qwen4-max-vision-video-understanding-beijing-free-quota

Evidence it actually ran

This is the shape of the stamp. It has not been earned, and the example date that follows is a placeholder, not a run: Ran on YYYY-MM-DD (Asia/Shanghai) with the pinned versions.

Command output
None recorded. A verified revision will quote the output from the run, not a sample written in advance.
Tests, CI, or Inspector
Not run for this draft.
Repository or config
No link recorded.

Failure modes

Anticipated only. None of these has been checked against a run of this tutorial.

  • Unchecked

    The video's audio track is treated as something qwen4-max will hear

    Official vision limits say qwen4-max will not understand the audio track of a video. Fixture B is silent on purpose. If the fact you need is only spoken, this API will not hear it.

  • Unchecked

    A PDF, Word, or plain-text file is sent as a document upload on the vision path

    Official guidance is to rasterize pages into images, or to use a document model such as Qwen-Long. Do not send a .pdf URL in image_url and hope.

  • Unchecked

    Image or video token use is underestimated because detail=high is left at the default

    Input tokens include the tokens the service derives from each image or video, and thinking counts as output. The planned script sets detail=low on the still image so a denser photograph does not silently climb toward the 16-million-pixel cap. A local formula estimate is not a usage value from the API.

  • Unchecked

    401 from a key and host in different regions, or a Token Plan / preview ID

    The script should not be pointed at a Token Plan host, a Singapore region key, or qwen4-max-preview. A region mismatch is a documented 401.

  • Unchecked

    The grant is exhausted and 用完即停 is on

    The service will not keep spending the free grant once the million tokens are gone and the stop switch is on. That refusal is the point of the switch.

Other tutorials in Integrate.