You sit down to ship a feature on Qwen and the first decision stalls you: which model? Qwen3, Qwen3.5, Qwen3-VL, Qwen3-Coder, Qwen3-Omni, QwQ, Qwen-Max, Qwen-Embedding, Qwen-Image, Wan. Alibaba's Qwen team ships models faster than most teams can track, and the surface area is enormous. That breadth is both the strength and the reason newcomers bounce off it.
One fact orients everything else. Qwen is the largest and most-downloaded open-source model family in the world, with downloads approaching a billion and accounting for over half of all open-weight model downloads by 2026 (Wikipedia: Qwen). That scale matters in a concrete way for a builder. Qwen is the default base model the entire open-source fine-tuning ecosystem is built around, and it spans more modalities (text, vision, audio, video, code, embeddings, image generation) than almost any competitor.
This guide maps the whole ecosystem, then goes deep on the parts a developer actually touches: the API, the Qwen-Agent framework, fine-tuning, and the RAG and multimodal building blocks.
TLDR
- Two access paths: open weights (Apache 2.0: download, fine-tune, self-host) and DashScope / Alibaba Cloud Model Studio (hosted API, OpenAI-compatible, free tier).
- The API adds function calling, a thinking-mode toggle, structured output, and multimodal input.
- Qwen-Agent is an open-source framework with function calling, MCP, a code interpreter, RAG, and a browser agent.
- Fine-tuning routes span Model Studio SFT/LoRA, ModelScope's
ms-swift, PAI, and every community tool, with embeddings, vision/omni models, and image/video generation alongside. - Qwen's edge is breadth and being the most fine-tunable open base in existence.
The ecosystem at a glance#
Qwen is not one product. It is a model family plus the Alibaba Cloud platform stack around it. Knowing which layer you are on keeps the rest of this guide oriented.
| Feature | What it is | Who uses it |
|---|---|---|
| Open-weight models | Downloadable models under Apache 2.0 you run anywhere | Engineers who need control, on-prem, or to fine-tune locally |
| DashScope / Model Studio | Alibaba Cloud's hosted API + console (the 'Bailian' platform) | Developers calling Qwen without managing GPUs |
| ModelScope | Alibaba's model hub (a Hugging Face equivalent) + ms-swift tooling | Developers downloading, fine-tuning, and sharing models |
| Qwen-Agent | Open-source agent framework built on Qwen | Developers building tool-using agents and RAG apps |
| Qwen Chat | The end-user chat app (qwen.ai), 200M+ users | End users; the consumer face of the models |
| PAI (Platform for AI) | Alibaba Cloud's full ML platform for large-scale training | Enterprises training and fine-tuning at scale |
For day-to-day development, the layers that matter are the open-weight models, DashScope/Model Studio (hosted API), and Qwen-Agent. The rest is either a consumer surface (Qwen Chat) or enterprise infrastructure (PAI). This guide lives in the developer layers.
The model lineup#
Qwen's defining trait is breadth: a model for nearly every task and size, refreshed constantly through the Qwen3 generation and beyond. The key distinction for a builder is open-weight vs proprietary: the open models (Apache 2.0) can be downloaded, fine-tuned, and self-hosted; the flagship "Max" models are proprietary and API-only.
| Feature | What it's for | Access |
|---|---|---|
| Qwen3 (dense 0.6B–32B) | General-purpose text, sized from edge to server; hybrid thinking mode | Open-weight |
| Qwen3 MoE (30B-A3B, 235B-A22B) | Stronger generalist performance at lower active-parameter cost | Open-weight |
| Qwen-Max / Qwen Max-tier | Flagship closed model, largest context and capability | API-only (proprietary) |
| QwQ / Qwen3 Thinking | Dedicated step-by-step reasoning | Open-weight |
| Qwen3-Coder (up to 480B-A35B) | Agentic coding and code completion | Open-weight |
| Qwen3-VL (2B–235B variants) | Vision-language: image and video understanding, spatial reasoning | Open-weight |
| Qwen3-Omni | Native omni-modal: text, image, audio, video in; text + speech out, realtime | Open-weight |
| Qwen3-Embedding (+ reranker) | Text/code embeddings and reranking for RAG and search | Open-weight |
| Qwen-Image / Qwen-Image-Edit | Image generation and semantic image editing | Open-weight |
| Wan (Wanxiang) | Video generation foundation model | Open-weight / API |
The practical reading: Qwen3 dense models are the everyday workhorses (pick the size your latency and hardware allow), MoE variants when you want more capability per active parameter, Max when you need the strongest closed model via API, QwQ/Thinking for hard reasoning, Coder for software tasks, VL/Omni for multimodal, and the Embedding models for RAG. Names and sizes churn fast, so always confirm against the Model Studio models list or the Qwen GitHub before committing.
Accessing the models: API, self-hosting, and hubs#
There are three ways to run Qwen, and the choice is your first architectural decision. The diagram below shows how each path connects the same open weights to your application.
1. DashScope / Model Studio API. The fastest path. Get a DASHSCOPE_API_KEY from Alibaba Cloud Model Studio and call the models over HTTP. The endpoints are OpenAI-compatible, so you can use the OpenAI SDK by pointing it at the DashScope base URL. Migrating existing code is often just a URL, key, and model-name change. New accounts get a free token tier.
from openai import OpenAI
client = OpenAI(
api_key="...", # DASHSCOPE_API_KEY
base_url="https://dashscope-intl.aliyuncs.com/compatible-mode/v1",
)
resp = client.chat.completions.create(
model="qwen-plus",
messages=[{"role": "user", "content": "Explain MoE routing in two sentences."}],
)
print(resp.choices[0].message.content)
2. Self-hosted open weights. Download an open-weight Qwen model from Hugging Face or ModelScope and serve it yourself with vLLM, SGLang, Ollama, or llama.cpp. All of them expose OpenAI-compatible endpoints. This is the serving stack we cover in Part 2 of the fine-tuning guide, and it gives you full control, no per-token cost, and data that never leaves your infrastructure.
3. Third-party clouds and hubs. Qwen models are widely available through other inference providers and cloud catalogs, which can be convenient if you are not on Alibaba Cloud.
The decision mirrors any open-weight provider: API to move fast; self-host for data control, cost at scale, or regulated environments. Because it is the same model either way, you can prototype on DashScope and migrate to self-hosting without rewriting prompts. For teams with data-residency concerns about a China-headquartered cloud, self-hosting the open weights is the clean answer.
Core API capabilities#
Beyond plain chat, three features make the API a real application backend.
Function calling#
Qwen3 models are strong at tool calling, and the API exposes it through the standard OpenAI-style tools parameter: you describe tools as JSON Schema, the model decides when to call them and with what arguments, and you execute the function and return the result. Qwen supports parallel tool calls, which is what makes it a capable agent brain.
Thinking mode#
A distinctive Qwen3 feature is the hybrid thinking toggle. The same model can answer directly (fast) or switch into an explicit step-by-step reasoning mode (slower, better on hard problems). You control it per request, via an enable_thinking flag in the native SDK or by selecting a "thinking" model variant, so you pay for deep reasoning only when the task needs it.
# Native DashScope SDK exposes the thinking toggle directly
import dashscope
resp = dashscope.Generation.call(
model="qwen-plus",
messages=[{"role": "user", "content": "Prove sqrt(2) is irrational."}],
enable_thinking=True,
)
Structured output and multimodal#
The API supports JSON-constrained responses for reliable machine-parsed output, and the vision models (Qwen3-VL) and omni model (Qwen3-Omni) accept images, audio, and video in the same request. A single endpoint can read a chart, transcribe audio, or answer questions about a video frame.
Building agents with the Qwen-Agent framework#
Function calling makes a model able to use tools. You still need an orchestration layer to run the loop, manage state, and host tools. Alibaba's answer is Qwen-Agent, an open-source framework built specifically around Qwen's tool-use, planning, and memory capabilities. It encapsulates the tool-calling templates and parsers internally, so you write far less plumbing.
At runtime the framework runs a simple loop: the model reasons, decides on a tool call, the framework executes the tool, and the result feeds back into the model until it produces a final answer.
What Qwen-Agent provides out of the box:
- Function calling with parallel calls, via a simple
@register_tooldecorator for custom tools. - MCP (Model Context Protocol) support, so you plug in external tools (APIs, databases, SaaS) as standardized MCP servers.
- Code Interpreter: a Docker-based sandbox for autonomous Python execution (computation, data analysis, charts).
- RAG: built-in document processing and long-context question-answering over your files.
- GUI components: Gradio-based web interfaces to ship an agent UI quickly.
- BrowserQwen: a browser-assistant extension for web interaction.
from qwen_agent.agents import Assistant
bot = Assistant(
llm={"model": "qwen-plus", "model_server": "dashscope"},
function_list=["code_interpreter", "my_custom_tool"],
system_message="You are a data analyst. Use tools before answering.",
)
for response in bot.run([{"role": "user", "content": "Plot the trend in sales.csv"}]):
print(response)
Qwen-Agent works with either DashScope (set DASHSCOPE_API_KEY) or a self-hosted Qwen behind an OpenAI-compatible server (vLLM, Ollama). It is the same code, just a different model_server. That portability is the same prototype-then-self-host story as the base models.
When should you use Qwen-Agent versus a provider-neutral framework like LangGraph? Use Qwen-Agent for the fastest path to a Qwen-native agent with built-in code interpreter, RAG, and browser tools. Use a framework (see Production AI Agents with LangGraph) when you need custom control flow, human-in-the-loop approval gates, multi-provider models, or your own observability and tracing. They compose: a LangGraph node can call a Qwen model, and a Qwen agent can call your MCP tools.
Fine-tuning is where Qwen really shines#
This is Qwen's standout developer story. Because the models are open-weight, permissively licensed, and span every size, Qwen is the most fine-tuned base model family in the open ecosystem, and virtually every fine-tuning tool supports it first. The general method choices (LoRA, data quality, evaluation) are covered in our LLM Fine-Tuning guide. Here is how Qwen specifically lets you do it.
| Feature | How it works | Choose it when |
|---|---|---|
| Model Studio (managed) | Fine-tune Qwen via Alibaba Cloud's HTTP API (SFT / LoRA), then deploy by model ID | You want zero infra and a hosted endpoint inside Alibaba Cloud |
| ms-swift (ModelScope) | Alibaba's official CLI bundling LoRA, QLoRA, full, DPO, ORPO; serve with swift deploy | You want a one-CLI workflow across methods on your own GPUs |
| Community tools | Unsloth, Axolotl, TRL, LLaMA-Factory all support Qwen first-class | You already use the standard open-source fine-tuning stack |
| PAI (enterprise) | Alibaba Cloud's ML platform for large-scale or distributed training | You need enterprise-scale training inside a managed VPC |
The Model Studio route is the managed path: format your data, fine-tune a Qwen base with SFT or LoRA over the HTTP API (datasets typically need at least ~1,000 high-quality examples), and deploy the result by its returned model ID. The ms-swift framework is Alibaba's own open-source CLI that bundles LoRA, QLoRA, full-parameter, DPO, and ORPO behind one interface and serves the result with an OpenAI-compatible swift deploy endpoint. And because Qwen is the community default, the entire toolchain from our fine-tuning guide treats Qwen as a first-class citizen: Unsloth (single-GPU speed), Axolotl (multi-GPU), TRL, and LLaMA-Factory. If you only learn one base model to fine-tune, Qwen is the safest bet.
# ms-swift: LoRA fine-tune a Qwen base, then serve it
swift sft --model Qwen/Qwen3-8B --train_type lora --dataset my_data.jsonl
swift deploy --adapters output/checkpoint --infer_backend vllm
RAG and multimodal building blocks#
Qwen ships the pieces around the LLM that production systems need.
Embeddings. The Qwen3-Embedding series (with a matching reranker) turns text and code into vectors for semantic search and RAG, available both open-weight and via the API. You embed, store, retrieve, and optionally rerank, the pipeline we detail in Build a RAG Search Pipeline and the RAG lifecycle series.
Vision and document understanding. Qwen3-VL reads images and video (charts, screenshots, documents, scenes) with strong spatial and temporal reasoning. That makes it a capable document-understanding and visual-agent model without a separate OCR stage for many tasks.
Generation beyond text. Qwen-Image and Qwen-Image-Edit generate and edit images, and Wan generates video, so the same provider covers multimodal output, not just input. For an application that needs to read a document, answer about it, and produce an annotated image, the whole loop stays within one model family.
Which Qwen piece for which job#
| Feature | Reach for | Why |
|---|---|---|
| Ship a chatbot fast | DashScope API + Qwen3 dense (qwen-plus / qwen-turbo) | Cheap, capable, OpenAI-compatible, free tier to start |
| Data must stay in-house | Open-weight Qwen3, self-hosted | Apache 2.0 weights run on your own GPUs, so no data leaves |
| Tool-using agent | Qwen-Agent (code interpreter + MCP + RAG) | Built-in tools and parsers; works hosted or self-hosted |
| Specialize on your data | ms-swift or Unsloth/Axolotl (LoRA), or Model Studio | Qwen is the most fine-tunable open base; pick managed or local |
| Coding assistant | Qwen3-Coder | Purpose-built for agentic coding and completion |
| Multimodal app | Qwen3-VL (vision), Qwen3-Omni (audio/video), Qwen-Image (gen) | One family covers image/audio/video input and image/video output |
| RAG over documents | Qwen3-Embedding + reranker | Open or API embeddings and reranking for retrieval quality |
Getting started in five minutes#
Get a DashScope API key
Create an Alibaba Cloud Model Studio account and generate a DashScope API key. Set it as an environment variable so it never lands in code.
export DASHSCOPE_API_KEY="..."
Use the OpenAI-compatible endpoint
You do not need a special SDK. Point the OpenAI client at DashScope.
pip install openai
Make your first call
Three lines against the compatible endpoint.
from openai import OpenAI
import os
client = OpenAI(api_key=os.environ["DASHSCOPE_API_KEY"],
base_url="https://dashscope-intl.aliyuncs.com/compatible-mode/v1")
print(client.chat.completions.create(
model="qwen-plus",
messages=[{"role": "user", "content": "Hello!"}],
).choices[0].message.content)
Add a capability
Layer in function calling, thinking mode, an embeddings index, or a Qwen-Agent. Each is an incremental change to the same setup, or a switch to a self-hosted model with the same code.
Tradeoffs and limitations: an honest read#
Qwen's strengths are unmatched in some dimensions: the broadest open-weight lineup in existence, permissive Apache 2.0 licensing on most models, first-class support across every fine-tuning tool, and modality coverage from text to video. If you want the most flexible open base to build and customize on, Qwen is the strongest default available.
The honest caveats. The sheer sprawl is a real cost. Model names and versions change constantly, and picking the right variant takes research, so pin a specific model version in production rather than chasing "latest." The flagship Max models are proprietary and API-only, so "everything is open" is not literally true. Check each model's access tier. Data-residency considerations apply if you use DashScope, since Alibaba Cloud is China-headquartered. For regulated or sensitive workloads, self-hosting the open weights (or using an international region or third-party host) is the clean path. And on the hardest frontier tasks, validate Qwen against alternatives on your workload rather than assuming parity. We frame these build-vs-buy and customization decisions in Fine-Tuning vs RAG for AI Products and System Design for AI Products, and you can compare directly with our companion guide on what Mistral provides for developers.
Key Takeaways#
- Qwen is the largest, most-downloaded open-weight model family, and the default base the entire open-source fine-tuning ecosystem is built around.
- Developers get two access paths: open weights (Apache 2.0, self-hostable) and DashScope / Model Studio (hosted, OpenAI-compatible, free tier). Prototype on the API, then migrate to self-host without rewriting prompts.
- The lineup is the broadest in AI: Qwen3 dense and MoE generalists, QwQ/Thinking for reasoning, Coder for code, VL and Omni for multimodal, Embedding for RAG, and Image/Wan for generation.
- The API adds function calling, a hybrid thinking-mode toggle (pay for deep reasoning only when needed), structured output, and multimodal input.
- Qwen-Agent is an open-source framework with built-in code interpreter, MCP, RAG, and browser tools that runs against hosted or self-hosted models.
- Fine-tuning is Qwen's superpower: Model Studio (managed), ms-swift (ModelScope CLI), PAI (enterprise), and every community tool (Unsloth, Axolotl, TRL) support it first.
FAQ#
Is Qwen open source or a paid API?
Both. Most Qwen models (Qwen3 dense and MoE, VL, Omni, Coder, Embedding, Image) are open-weight under Apache 2.0, so you can download and self-host them freely. The flagship "Max" models are proprietary and available only through the DashScope API. You can mix: prototype on the API, then self-host the open-weight models in production.
Is the Qwen API compatible with OpenAI code?
Yes. DashScope exposes an OpenAI-compatible endpoint, so you can use the OpenAI SDK by changing the base URL, key, and model name. There is also a native dashscope SDK that exposes Qwen-specific features like the enable_thinking toggle.
How do I fine-tune a Qwen model?
Several ways. Alibaba Cloud Model Studio offers managed SFT/LoRA via HTTP API with one-click deployment. ModelScope's ms-swift CLI bundles LoRA, QLoRA, full, DPO, and ORPO and serves the result with an OpenAI-compatible endpoint. And because Qwen is the community default, Unsloth, Axolotl, TRL, and LLaMA-Factory all support it first-class. See our LLM Fine-Tuning guide for the method choices.
Should I use Qwen-Agent or a framework like LangGraph?
Use Qwen-Agent for the fastest path to a Qwen-native agent with built-in code interpreter, RAG, MCP, and browser tools. Use a framework like LangGraph when you need custom control flow, human-in-the-loop gates, multi-provider models, or your own tracing. They compose: LangGraph can call Qwen models, and Qwen-Agent can call your MCP tools.
What is "thinking mode" in Qwen3?
A toggle that switches the same model between fast direct answers and explicit step-by-step reasoning. You enable it per request (via enable_thinking or a thinking model variant), so you only pay the extra latency and tokens of deep reasoning on the hard problems that need it.
Which Qwen model should I start with?
For most applications, start with a mid-size Qwen3 dense model (via qwen-plus on the API, or an 8B/14B open weight self-hosted). It is strong, cheap, and well-supported. Move up to a MoE or Max model for more capability, drop to a smaller dense model for the edge, and use Coder, VL, or Omni for code and multimodal work. Validate the choice on your own task and budget.