A good Qwen prompt starts by naming the task—not by adding a magic phrase. Tell the model what to do, provide the input or context it needs, state important constraints, and describe the answer you want. Then choose a Qwen model and API documented for that task: a chat prompt is not an image-generation request, and image-editing instructions are not a universal Qwen prompt format.
A practical Qwen prompt template
For a text or chat task, adapt this structure:
Task: [What should the model do?]
Context or input: [The text, facts, or material it should use]
Constraints: [What to include, exclude, preserve, or verify]
Output: [Format, length, tone, and any required fields]
If information is missing, say what is missing rather than guessing.
Example: summarize a document
Task: Summarize the report below for a busy operations manager.
Context: Use only the report text provided here.
Constraints: Include the three main findings and any stated risks. Do not add outside facts.
Output: Five bullets, followed by one sentence listing unanswered questions.
[Paste report]
Example: extract invoice information as JSON
Task: Extract the invoice details from the text below.
Constraints: Use only values explicitly present. Use null for a missing value.
Output: Return JSON with these keys: invoice_number, invoice_date, currency, total.
[Paste invoice text]
These are adaptable prompt-writing examples, not claims that particular wording is required or tested for every Qwen model. For Model Studio Chat Completions, send instructions and source text in messages and specify the model with model. Model Studio documents both OpenAI-compatible and DashScope API access. (help.aliyun.com)
For machine-readable output, Model Studio documents JSON Object mode using response_format: {"type":"json_object"}; include the word “JSON” in a system or user message. This mode ensures valid JSON, but does not guarantee your requested keys or types—validate those in your application. The structured-output support listing includes the Qwen3.8-Max and Qwen3.8-Flash families. Model Studio also documents JSON Schema mode for listed models when you need schema-conforming output; confirm support for the exact model and endpoint you use. (help.aliyun.com)
Prompts for image generation and editing
Use an image model and its corresponding image API for image tasks. Model Studio documents qwen-image-3.0-pro and qwen-image-3.0 for text-to-image generation and image-to-image editing. For generation, provide a text prompt; for editing, provide reference image(s) together with editing instructions. (alibabacloud.com)
For image generation, describe the subject, setting, composition, visual style, and any text or layout requirements that matter. For example:
Create a square café menu poster for a neighborhood bakery.
Show a warm, sunlit counter with a cup of coffee and a croissant.
Use a restrained cream-and-dark-green palette and leave clear space at the top for a title.
Render the exact title “Morning Menu” in English. Do not add other readable text.
For image editing, identify the change and say what should remain unchanged. If you provide reference images, make their roles clear. The DashScope example for qwen-image-3.0-pro places an image and instruction in the user message’s content list, using image and text items; the image may be supplied as a public URL or base64 data. A compact shape is:
messages = [{
"role": "user",
"content": [
{"image": image_url_or_base64_data},
{"text": "In the input image, change the background to a quiet beach at sunset. Keep the person, clothing, pose, framing, and visible text unchanged."}
]
}]
Use the documented image protocol and example for your chosen model rather than assuming a chat-text request accepts images in the same format. (help.aliyun.com)
These are practical examples, not guaranteed outcomes. Model Studio recommends qwen-image-3.0-pro for image generation and editing tasks including complex layouts and text rendering. That is a provider recommendation, not a guarantee of perfect lettering or preservation of every unmentioned detail. Review results when exact text, logos, or product details matter. (alibabacloud.com)
Which Qwen model should you use?
Choose by task, then verify the exact model ID and capability listing for your API deployment. Model Studio supports Qwen calls through OpenAI-compatible interfaces and the DashScope SDK. (help.aliyun.com)
| Your task | Starting point | Why—and what to check |
|---|---|---|
| Everyday chat, summaries, or coding help | qwen3.8-flash |
Model Studio positions Flash as a fast multimodal model and lists image, text, and video input, plus a million-token context window. Check limits and features for your deployment. (help.aliyun.com) |
| More demanding professional or multimodal reasoning | qwen3.8-max |
Model Studio describes Max as a flagship and lists image, text, and video input. Its capability page lists structured output and function calling, with support varying by deployment scope. (alibabacloud.com) |
| Generate or edit images | qwen-image-3.0-pro or qwen-image-3.0 |
The API reference lists both for generation and editing. Model Studio recommends Pro for tasks such as complex layouts and text rendering. Compare results on representative inputs. (alibabacloud.com) |
| Analyze an image as part of a text task | A vision-capable chat model, such as qwen3.8-flash or qwen3.8-max |
Both model pages list image input and text output. Choose an image-generation/editing model only when you need to create or modify an image. (alibabacloud.com) |
These are starting choices, not a universal ranking. For the Qwen Image API, Model Studio specifies that the model, endpoint URL, and API key must belong to the same region. Use the matching regional endpoint and key, and check model availability in your target region. (alibabacloud.com)
Production API: apply the prompt and controls
For text prompts using Chat Completions, put the task and input in messages, specify the documented model ID with model, and add response_format when you need structured output. For example, JSON Object mode uses:
{
"model": "qwen3.8-flash",
"messages": [{"role": "user", "content": "Return JSON with invoice_number and total. JSON. [Paste invoice]"}],
"response_format": {"type": "json_object"}
}
This requests valid JSON, not exact schema conformance. Model Studio’s structured-output listing includes Qwen3.8-Flash and Qwen3.8-Max; use JSON Schema only when the selected model and endpoint list it as supported. Validate fields and values in your application. (help.aliyun.com)
For image tasks, the DashScope example uses the selected image model in model and places the prompt and reference image in the user message’s content list as text and image items. For generation, use the text instruction; for editing, include the source/reference image and the edit instruction. Follow the API example for the model and protocol you actually use. (help.aliyun.com)
Keep API keys in environment variables rather than hard-coding them in application source. Check the model’s documented input/output limits, endpoint, and capabilities for the deployment and region you will call. (help.aliyun.com)
Thinking controls are model- and request-specific
For qwen3.8-max, Model Studio’s OpenAI-compatible Chat Completions example passes enable_thinking through extra_body, because it is not a standard OpenAI parameter. The guide says thinking can be enabled or disabled per request, but that control parameters vary by model. Do not assume the Max example’s control placement or behavior applies to Flash; check Flash’s current model-specific API guidance before setting a thinking-mode parameter. (alibabacloud.com)
A separate security analysis reported that /no_think behavior persisted across several turns in one Ollama test using qwen3:14b-q8_0 with a 500-token context setting. This is an author-reported local test, not API documentation or proof that the same effect occurs with a hosted Model Studio model. If application behavior depends on controlled reasoning settings, keep that control in API or application configuration rather than trusting arbitrary user text.
One plugin example is not a universal Qwen prompt rule
A third-party ComfyUI node shows a useful image-editing pattern: specify the requested change, name details to preserve, and identify reference images clearly. But that page describes the node’s own prompt and JSON output contract, not a general Qwen requirement. It also reports that its prompt-enhancement model receives reduced-size images, which may affect its reading of small text or fine details. Treat those rules and limits as plugin-specific. (ComfyUI node documentation)
Bottom line: write prompts around the task, input, constraints, and desired output; then select a model and API documented for that modality. Treat examples as starting drafts, validate structured responses, and check the exact model capabilities and request requirements before production use.
Sources
Qwen Image Generation and Editing API Reference
qwen3.8-flash model information
Use deep thinking models via API
Make your first API call to Qwen
Prompt Injection and Mode Drift in Qwen3 - a security analysis
