Qwen API is not one universal endpoint or one interchangeable catalog of model names. Developers can use the official QwenCloud pay-as-you-go or Token Plan routes, Alibaba Cloud Model Studio, an independent provider such as Fireworks AI, or a self-hosted runtime such as vLLM. Each route has its own base URL, credentials, model IDs, lifecycle, feature coverage, pricing, and data-handling rules.
This guide separates QwenCloud and Alibaba Cloud Model Studio before showing OpenAI-compatible Chat Completions, Responses, streaming, Thinking, function calling, structured JSON output, and vision. It also explains what changes when you use Fireworks or self-host an open-weight Qwen checkpoint.
Verification status
Last reviewed: August 4, 2026.
The production IDs and provider-published specifications were checked against first-party QwenCloud and Alibaba Cloud pages. This review also checked the Bailian / China Model Studio October 10, 2026 notice for qwen-turbo and qwen-turbo-realtime, the separate QwenCloud international Turbo status, the conflicting Qwen3.7 output limits, and list-price versus promotional labels. No authenticated inference or realtime request was completed during this update. Existing examples remain documentation-based unless a test record explicitly states the endpoint, key type, region, deployment scope, model, protocol, date, status, request ID, usage, and output.
Contents
- What is the Qwen API?
- Choose a Qwen API route
- Current, preview, and legacy model IDs
- Routes, regions, and base URLs
- Authentication and key safety
- SDK versions
- Runnable Node.js example
- Runnable Python example
- Chat Completions
- Responses API
- Streaming
- Thinking
- Function calling
- Structured output
- Vision
- Rate limits
- Errors and retries
- Pricing
- Frequently asked questions
What is the Qwen API?
The term “Qwen API” usually means an HTTP interface used to send prompts and receive output from a Qwen model. Official managed access includes QwenCloud and Alibaba Cloud Model Studio. Both offer OpenAI-compatible interfaces for supported models, but their endpoints, keys, catalogs, plans, and published feature matrices are separate.
OpenAI-compatible describes a familiar request shape; it does not guarantee identical model names, parameters, tool behavior, retention, or quotas. A model ID that works in Model Studio should not be copied into Fireworks, and a hosted commercial alias should not be assumed to have downloadable weights.
QwenCloud, Model Studio, Fireworks, or self-hosting?
Choose the route before copying a model ID, endpoint, key, or price.
| Route | Connection and model naming | Best fit | Important boundary |
|---|---|---|---|
| QwenCloud pay as you go | https://dashscope-intl.aliyuncs.com/compatible-mode/v1, a QwenCloud PAYG key, and an exposed ID such as qwen3.8-max |
Applications and API integrations billed by usage | Confirm the exact protocol, model, account, and price. Marketplace pricing is not a Model Studio regional quote. |
| QwenCloud Token Plan | https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1, a dedicated Token Plan key, and an exact allowlisted ID |
Interactive compatible programming and agent tools | Both Qwen3.8 IDs are allowlisted, but automated scripts, application backends, and non-interactive batch processing are prohibited. |
| Alibaba Cloud Model Studio | A regional workspace URL, matching regional key, and a model exposed in that workspace | Alibaba Cloud deployments and regional controls | The current matrix recommends qwen3.8-max, but availability, protocol, quota, and price must be verified for the exact region. |
| Fireworks AI | https://api.fireworks.ai/inference/v1, a Fireworks key, and a provider resource path |
Independent managed inference | Do not infer Fireworks availability or features from QwenCloud. |
| Self-hosted vLLM | Your server and an exact open-checkpoint repository ID | Infrastructure and data-path control | Hosted Max IDs are not downloadable checkpoints. |
Fireworks configuration
Fireworks uses the OpenAI-compatible base URL https://api.fireworks.ai/inference/v1 and the environment variable FIREWORKS_API_KEY. Its model field normally contains a resource path such as accounts/fireworks/models/<model-slug>. Copy the exact path from the Fireworks Model Library instead of converting an Alibaba or Hugging Face ID yourself.
import OpenAI from "openai";
const fireworks = new OpenAI({
apiKey: process.env.FIREWORKS_API_KEY,
baseURL: "https://api.fireworks.ai/inference/v1",
});
const response = await fireworks.responses.create({
model: "accounts/fireworks/models/qwen3p7-plus",
input: "Explain prompt caching in two sentences.",
store: false,
});
console.log(response.output_text);
The Fireworks path above was documented on the verification date. Recheck its model card before publication or deployment because availability and serving paths can change. Fireworks Responses storage and retention rules also differ from Chat Completions; store: false prevents continuation through previous_response_id.
Self-hosted vLLM configuration
Self-hosting applies to an open-weight checkpoint, not automatically to a commercial hosted alias such as qwen-plus or qwen3.7-plus. A basic vLLM server can expose an OpenAI-compatible endpoint:
vllm serve Qwen/Qwen3-8B --api-key token-abc123
import OpenAI from "openai";
const local = new OpenAI({
apiKey: "token-abc123",
baseURL: "http://localhost:8000/v1",
});
const completion = await local.chat.completions.create({
model: "Qwen/Qwen3-8B",
messages: [{ role: "user", content: "Hello" }],
});
console.log(completion.choices[0].message.content);
Chat templates, reasoning parsers, tool parsers, parallel tool behavior, and Responses state depend on the exact checkpoint and vLLM version. Copy parser flags from the official card for that checkpoint. Do not present a local OpenAI-compatible server as feature-identical to Model Studio or Fireworks.
Current production, preview, and legacy Qwen API model IDs
QwenCloud current production and preview models
| Model ID | Documented context | Status and access |
|---|---|---|
qwen3.8-max |
1M category | Production flagship released August 3, 2026; listed by the current selector, Marketplace, Responses reference, and both Token Plan allowlists. QwenCloud Marketplace list price: $2 input / $6 output per 1M tokens. See the Qwen3.8 Max guide. |
qwen3.8-max-preview |
1M category | Separate preview still allowlisted. Do not call it retired or assign production PAYG pricing to preview Credits. |
qwen3.7-max |
1M | Older hosted Max entry still listed where supported; no retirement date verified. |
qwen3.7-plus |
1M | Current balanced hosted starting point. |
qwen3.7-flash / qwen3.7-flash-2026-07-15 |
Up to 1M | Current lower-cost alias and dated snapshot where supported. |
Hosted IDs are not public checkpoint names. No official public Qwen3.8 Max weights or license were verified.
Alibaba Cloud Model Studio documented starting points
| Model ID | Documented context | Status and boundary |
|---|---|---|
qwen3.7-max |
1M tokens | Recommended hosted model in the regional Model Studio matrix checked for this guide |
qwen3.7-plus |
1M tokens | Recommended hosted balance for supported text, reasoning, tools, and visual input |
qwen3.6-flash |
1M tokens | Documented lower-cost regional starting point in the Model Studio matrix checked here |
The QwenCloud release of qwen3.7-flash does not prove identical availability in every Alibaba Cloud Model Studio workspace. The logged-in Singapore console may show models before every public regional matrix is updated; verify the exact ID in the target workspace instead of copying it across routes.
Legacy and retiring references
| Reference | Verified status | Use this guide |
|---|---|---|
qwen-flash |
Legacy family; the current legacy alias maps to qwen-flash-2025-07-28 in the checked Model Studio documentation |
Qwen Flash model and migration guide |
qwen-turbo and qwen-turbo-realtime |
Alibaba Cloud’s Bailian / China Model Studio lifecycle table schedules both hosted IDs for decommissioning on October 10, 2026 and recommends the latest Qwen 3.7 and 3.6 models rather than one exact successor. QwenCloud international still lists qwen-turbo as Legacy, and its current deprecation table does not list Turbo; no current international listing was verified for qwen-turbo-realtime. |
Qwen Turbo status and migration guide |
qwen-max and Qwen2.5-Max |
The floating legacy hosted alias is not the same identity as a dated Qwen2.5-Max snapshot | Qwen2.5-Max historical reference |
qwen3-14b |
128K managed-API context; the Alibaba Cloud Bailian / China Model Studio lifecycle table schedules this hosted ID for decommissioning on October 10, 2026. Self-hosted open weights have a separate lifecycle. | Current Qwen model selector |
| Qwen2.5-VL hosted and open variants | Historical visual family; hosted aliases and downloadable checkpoints must be identified separately | Qwen2.5-VL model, API, and license guide |
Hosted Turbo lifecycle boundary
Route-specific notice, checked August 4, 2026: the Alibaba Cloud Bailian / China Model Studio lifecycle table and official notice schedule the exact hosted IDs qwen-turbo and qwen-turbo-realtime for decommissioning on October 10, 2026. The guidance names the latest Qwen 3.7 and 3.6 models, not one universal drop-in ID.
QwenCloud international remains a separate route: its qwen-turbo Marketplace card and text-model matrix still listed qwen-turbo as Legacy, while the QwenCloud deprecation table did not include Turbo. No current QwenCloud international listing was verified for qwen-turbo-realtime. Confirm the provider, deployment scope, key, endpoint, and account notice; do not universalize the Bailian deadline.
For the affected Bailian / China Model Studio route, the policy says calls remain functional before the deadline, although QPM and TPM may be reduced during the notice period. From the official decommissioning time, inference calls to those hosted IDs fail. Unrelated IDs such as qwen-omni-turbo-realtime and qwen-tts-realtime are different products and are not substitutes merely because their names overlap.
Official Qwen3.7 output-limit discrepancy
Checked August 4, 2026: QwenCloud’s model-specific Marketplace cards for qwen3.7-max, qwen3.7-plus, and qwen3.7-flash displayed a 131K maximum output. The QwenCloud text-model matrix displayed 64K for the corresponding rolling IDs, and its vision-model matrix displayed 64K for Plus, Flash, and the listed Max snapshot. Neither path exposed a visible revision date. Until QwenCloud reconciles the pages, treat the limit as documentation-path and endpoint specific, configure conservatively, and verify the accepted max_tokens or max_completion_tokens value for the exact model, protocol, account, and deployment scope. No maximum was independently live tested for this update.
List price and promotion are different fields
Checked August 4, 2026: the QwenCloud PAYG pricing guide labels its figures as list prices and directs readers to Marketplace for promotions. It listed Qwen3.7 Max at $2.50 input / $7.50 output per 1M tokens and Qwen3.7 Plus at $0.40 / $1.60 through 256K input, then $1.20 / $4.80 above 256K through 1M. On the same date, the Max card displayed a temporary 50% promotion ($1.25 / $3.75), and the Plus card displayed 20% off its first band ($0.32 / $1.28). Keep list price as the comparison baseline and show any promotion separately with its date; do not move a price between providers, regions, or deployment scopes.
Responses boundary: QwenCloud’s current OpenAI-compatible Responses reference explicitly lists both qwen3.8-max and qwen3.8-max-preview, along with Qwen3.7 and selected older models. The generic Chat reference points readers to the live model table, and some feature-guide examples still use Qwen3.7 IDs. Check the exact current reference for the chosen route and feature. An official allowlist is evidence of documented support, not evidence that this site completed a successful authenticated request.
Three model-name errors to avoid
qwen3-maxis a hosted commercial model ID. It is not another name for the separate open modelqwen3-235b-a22b.qwen3-14b-thinkis not a documented Model Studio ID. For the hybrid Qwen3 14B Chat model, useqwen3-14bwithenable_thinking: true, provided your region offers it.- Qwen3-Omni is a separate multimodal family. It should not be described as a universal replacement for Max, Plus, Flash, VL, or Coder models.
Routes, regions, and base URLs
QwenCloud endpoints
Token Plan use restriction: Token Plan is for interactive use inside compatible programming and agent tools. QwenCloud prohibits automated scripts, application backends, and non-interactive batch processing. Use QwenCloud pay as you go for an application or API integration. Token Plan, PAYG, Coding Plan, and Model Studio keys and base URLs are not interchangeable.
| QwenCloud route | OpenAI-compatible base URL | Credential boundary |
|---|---|---|
| Pay as you go | https://dashscope-intl.aliyuncs.com/compatible-mode/v1 |
Use a QwenCloud PAYG API key |
| Token Plan | https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1 |
Use a Token Plan API key; do not reuse a PAYG or Model Studio key |
Alibaba Cloud Model Studio regional endpoints
Model Studio documents six regions. Five use a workspace-dedicated hostname. US (Virginia) uses the listed DashScope hostname without a WorkspaceId placeholder.
| Region | OpenAI-compatible base URL | Workspace ID in hostname? |
|---|---|---|
| Singapore | https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1 |
Yes |
| China (Beijing) | https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/compatible-mode/v1 |
Yes |
| China (Hong Kong) | https://{WorkspaceId}.cn-hongkong.maas.aliyuncs.com/compatible-mode/v1 |
Yes |
| Japan (Tokyo) | https://{WorkspaceId}.ap-northeast-1.maas.aliyuncs.com/compatible-mode/v1 |
Yes |
| Germany (Frankfurt) | https://{WorkspaceId}.eu-central-1.maas.aliyuncs.com/compatible-mode/v1 |
Yes |
| US (Virginia) | https://dashscope-us.aliyuncs.com/compatible-mode/v1 |
No |
Use the base URL itself in the SDK. The SDK adds /chat/completions or /responses. Do not append the operation path to the configured base URL.
Key-scope rule: a QwenCloud PAYG key, a QwenCloud Token Plan key, and an Alibaba Cloud Model Studio regional workspace key are not interchangeable. The endpoint, credential, model catalog, plan, and region must match.
Authentication and API-key safety
All managed routes use a Bearer API key, but the key must belong to the configured route. The example below uses an Alibaba Cloud Model Studio Singapore workspace; replace both values together for QwenCloud PAYG or Token Plan.
export DASHSCOPE_API_KEY="replace-with-your-regional-key"
export DASHSCOPE_BASE_URL="https://YOUR_WORKSPACE_ID.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1"
A raw HTTP request uses these headers:
Authorization: Bearer YOUR_DASHSCOPE_API_KEY
Content-Type: application/json
- Never place the key in browser JavaScript, a public repository, a mobile bundle, or a
NEXT_PUBLIC_*variable. - Call Model Studio from your server, serverless function, or protected backend route.
- Do not mix QwenCloud PAYG, QwenCloud Token Plan, Alibaba Cloud Model Studio regional, Coding Plan, or other plan credentials and endpoints.
- Rotate a key immediately if it is exposed, and review account usage and logs.
SDK versions used for this guide
Alibaba’s installation guide tells developers to install or upgrade the OpenAI SDK but does not pin a minimum package version. The request shapes and method names in this page were checked against the official examples and these package releases:
| Language | Package | Verified version |
|---|---|---|
| Node.js | openai |
6.48.0 |
| Python | openai |
2.46.0 |
npm install [email protected]
python -m pip install "openai==2.46.0"
The pinned Python package requires Python 3.9 or newer. Record dependencies in your lockfile and retest before upgrading. Do not use the obsolete global configuration pattern openai.api_base = "..." or the removed call openai.ChatCompletion.create(...).
Runnable Node.js Qwen API example
This server-side ES module calls Model Studio Chat Completions. Save it as qwen-chat.mjs, set the two environment variables shown above, and run node qwen-chat.mjs.
import OpenAI from "openai";
const apiKey = process.env.DASHSCOPE_API_KEY;
const baseURL = process.env.DASHSCOPE_BASE_URL;
if (!apiKey || !baseURL) {
throw new Error(
"Set DASHSCOPE_API_KEY and DASHSCOPE_BASE_URL before running this file."
);
}
const client = new OpenAI({ apiKey, baseURL });
const completion = await client.chat.completions.create({
model: "qwen3.7-plus",
messages: [
{
role: "system",
content: "Answer accurately and state uncertainty when necessary.",
},
{
role: "user",
content: "Explain the difference between RPM and TPM in three sentences.",
},
],
enable_thinking: false,
});
console.log(completion.choices[0].message.content);
If qwen3.7-plus is not listed in your selected region, choose a supported model from that region’s official matrix rather than guessing an alias.
Runnable Python Qwen Responses API example
This example uses the Model Studio Responses API and the same regional environment variables:
import os
from openai import OpenAI
api_key = os.getenv("DASHSCOPE_API_KEY")
base_url = os.getenv("DASHSCOPE_BASE_URL")
if not api_key or not base_url:
raise RuntimeError(
"Set DASHSCOPE_API_KEY and DASHSCOPE_BASE_URL before running this file."
)
client = OpenAI(api_key=api_key, base_url=base_url)
response = client.responses.create(
model="qwen3.7-plus",
input="Give two practical reasons to stream a long model response.",
)
print(response.output_text)
Chat Completions API
Chat Completions uses a messages array and returns an assistant message under choices[0].message. It is the appropriate Model Studio compatibility interface when you need chat history, Qwen’s Chat-specific Thinking control, supported image or video content, JSON mode, or the documented Chat tool schema.
const completion = await client.chat.completions.create({
model: "qwen3.7-plus",
messages: [
{ role: "system", content: "Be concise." },
{ role: "user", content: "What is an API context window?" },
],
enable_thinking: false,
});
console.log(completion.choices[0].message.content);
console.log(completion.usage);
The full HTTP operation is POST {baseURL}/chat/completions. With the Singapore workspace example, that becomes POST https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1/chat/completions.
Responses API
Model Studio’s OpenAI-compatible Responses API uses input and returns typed output items plus the convenience property output_text. Use the supported path {baseURL}/responses. Do not use the older /api/v2/apps/protocols/compatible-mode/v1/responses path, which Alibaba marks for deprecation.
const response = await client.responses.create({
model: "qwen3.7-plus",
input: "Compare stateless and stateful API conversations.",
reasoning: { effort: "medium" },
});
console.log(response.output_text);
previous_response_idcan link a follow-up request to a prior response. Model Studio documents a seven-day validity period for the response ID.backgroundexecution is not supported; requests are synchronous.- Only parameters explicitly listed in the Model Studio Responses reference are processed. Do not assume every OpenAI Responses parameter is honored.
- Responses support is model- and route-specific. QwenCloud’s current reference explicitly lists production
qwen3.8-maxand the separateqwen3.8-max-preview, along with Qwen3.7 and selected older models. Recheck the exact provider reference and complete an authenticated test before calling a site example live tested.
Chat Completions or Responses?
| Need | Use |
|---|---|
| Traditional role-based chat and broad compatibility | Chat Completions |
Typed response events, output_text, or previous_response_id |
Responses |
Chat JSON mode through response_format |
Chat Completions |
| Image plus text with a Responses-supported model | Responses or Chat Completions, using the API-specific content schema |
| Video or audio input through the OpenAI-compatible interface | Use the documented Chat or native DashScope route for a supported model; Responses does not accept video or audio input |
Streaming
Streaming sends incremental output instead of waiting for the complete response. It improves perceived latency and is recommended for long generation. Model Studio notes that a non-streaming call can be interrupted when it runs for too long.
Chat Completions streaming in Node.js
const stream = await client.chat.completions.create({
model: "qwen3.7-plus",
messages: [{ role: "user", content: "Explain streaming in five bullets." }],
enable_thinking: false,
stream: true,
stream_options: { include_usage: true },
});
for await (const chunk of stream) {
const text = chunk.choices[0]?.delta?.content;
if (text) process.stdout.write(text);
if (chunk.usage) {
console.log("\nUsage:", chunk.usage);
}
}
When include_usage is enabled, the final usage chunk can have an empty choices array, so optional chaining is necessary.
Responses streaming in Node.js
const stream = await client.responses.create({
model: "qwen3.7-plus",
input: "Explain streaming in five bullets.",
stream: true,
});
for await (const event of stream) {
if (event.type === "response.output_text.delta") {
process.stdout.write(event.delta);
}
if (event.type === "response.completed") {
console.log("\nUsage:", event.response.usage);
}
}
Responses uses typed events such as response.output_text.delta, response.output_text.done, and response.completed. Do not parse it as a Chat Completions chunk stream.
Qwen Thinking
Thinking controls are API-specific. Copying the same field into Chat Completions and Responses can produce incorrect behavior.
| Interface | Control | Output handling |
|---|---|---|
| Chat Completions, Node.js or raw HTTP | enable_thinking: true |
Reasoning is exposed through reasoning_content; final answer through content |
| Chat Completions, Python OpenAI SDK | extra_body={"enable_thinking": True} |
Read the returned reasoning and answer fields supported by the response object |
| Responses API | reasoning: { effort: "medium" } |
Reasoning appears as typed output items and reasoning-token usage |
QwenCloud Responses documents none, minimal, low, medium, high, xhigh, and max, with xhigh as the documented default on the review date. Alibaba Cloud Model Studio can publish a different supported set or default. In Responses, use the current route-specific reference; where supported, reasoning.effort takes priority and enable_thinking is the older control.
# Chat Completions with Python
completion = client.chat.completions.create(
model="qwen3.7-plus",
messages=[{"role": "user", "content": "Solve this carefully."}],
stream=True,
extra_body={"enable_thinking": True},
)
Thinking support and defaults differ by model family. Do not invent a -think suffix. Use a documented hybrid model with the documented control, or choose an explicitly listed thinking-only model ID.
Function calling
Function calling lets the model propose a structured call to a function your application defines. The model does not execute your database query, payment action, search, or private API. Your code must validate the arguments, authorize the action, execute it, and return the result to the model.
For a complete task-specific pattern—with authenticated identity, allowlisted read-only tools, strict argument validation, deterministic rendering, and human escalation—see the Qwen AI customer-support automation guide.
Chat Completions tool schema
const first = await client.chat.completions.create({
model: "qwen3.7-plus",
enable_thinking: false,
messages: [
{ role: "user", content: "What is the weather in Cairo?" },
],
tools: [
{
type: "function",
function: {
name: "get_weather",
description: "Get weather for a city",
parameters: {
type: "object",
properties: {
city: { type: "string" },
},
required: ["city"],
additionalProperties: false,
},
},
},
],
tool_choice: "auto",
});
const toolCalls = first.choices[0].message.tool_calls ?? [];
For each returned call, parse toolCall.function.arguments, validate it, run the approved function, and append a message with role: "tool", the matching tool_call_id, and the serialized result. Then send the expanded message history to Chat Completions again.
Chat tools use a nested function object. Responses custom tools use a flattened schema with name, description, and parameters beside type: "function". A Responses tool result is an input item of type function_call_output linked by the returned call_id. Do not copy one schema unchanged into the other API.
In non-thinking Chat calls, documented tool_choice controls include auto, none, required, and a forced named function. For deep-thinking tool calls, Model Studio restricts tool_choice to auto or none.
For coding-agent model identity and retirement boundaries, see the Qwen3-Coder guide. For an end-to-end commerce workflow that keeps authorization and transactions outside the model, see the Qwen e-commerce integration guide.
Structured JSON output
Model Studio documents JSON mode for supported Chat Completions models through response_format: { type: "json_object" }. The prompt must contain the word “JSON” in any letter case, or the request can fail. Disable Thinking when strict parseability matters, parse the result, and validate it against your own schema.
const completion = await client.chat.completions.create({
model: "qwen3.7-plus",
enable_thinking: false,
messages: [
{
role: "system",
content: "Return valid JSON only with keys name and category.",
},
{
role: "user",
content: "Classify Qwen API documentation.",
},
],
response_format: { type: "json_object" },
});
const data = JSON.parse(completion.choices[0].message.content);
console.log(data);
- JSON mode guarantees neither business-rule correctness nor compliance with an application-specific schema.
- A truncated response can be invalid JSON. Avoid an output limit that is too small for the requested structure.
- The Model Studio Responses reference does not list Chat Completions
response_format. Do not promise that this field works by copying it into Responses.
For a governed analytics example that validates a JSON query plan and compiles SQL in application code instead of executing model-written SQL, see the Qwen AI data analytics workflow guide.
Vision
For a Model Studio model that accepts visual input, Chat Completions places image and text items in the same user message. qwen3.7-plus was documented with text, image, and video input and text output on the verification date.
const imageUrl = process.env.IMAGE_URL;
if (!imageUrl) {
throw new Error("Set IMAGE_URL to a publicly accessible image URL.");
}
const completion = await client.chat.completions.create({
model: "qwen3.7-plus",
enable_thinking: false,
messages: [
{
role: "user",
content: [
{
type: "image_url",
image_url: { url: imageUrl },
},
{
type: "text",
text: "Describe only what is visible. Do not infer identities.",
},
],
},
],
});
console.log(completion.choices[0].message.content);
A base64 data URL is an alternative to a remote image URL. Chat video input uses the separately documented video_url content type with a supported model. The Responses API uses different content types such as input_text and input_image; its Model Studio compatibility interface does not support video or audio input.
Vision input does not mean image generation. These examples ask a model to inspect an image and return text. Image generation belongs to a supported image-generation model and its documented API.
Rate limits
Model Studio publishes model- and region-specific limits. Requests are aggregated at the Alibaba Cloud root-account level across RAM users, workspaces, and API keys. Any applicable requests-per-minute (RPM), tokens-per-minute (TPM), requests-per-second (RPS), tokens-per-second (TPS), or burst threshold can throttle a request.
The following defaults were listed for stable aliases on July 21, 2026. They are a dated reference, not a permanent global quota.
| Region | qwen3.7-maxRPM / TPM |
qwen3.7-plusRPM / TPM |
qwen3.6-flashRPM / TPM |
|---|---|---|---|
| Singapore | 600 / 1,000,000 | 15,000 / 5,000,000 | 15,000 / 5,000,000 |
| US (Virginia) | 30,000 / 5,000,000 | 30,000 / 5,000,000 | 15,000 / 5,000,000 |
| China (Beijing) | 30,000 / 5,000,000 | 30,000 / 5,000,000 | 30,000 / 10,000,000 |
| Germany (Frankfurt) | 30,000 / 5,000,000 | 30,000 / 5,000,000 | 15,000 / 5,000,000 |
| Japan (Tokyo) | 30,000 / 5,000,000 | 30,000 / 5,000,000 | 15,000 / 5,000,000 |
The Hong Kong rate-limit table did not list all three aliases on the verification date, so this page does not infer identical availability or quotas there. Dated snapshots can also have much lower limits than stable aliases. Check the official table and your console before capacity planning.
- RPM/RPS error: reduce request concurrency and smooth traffic.
- TPM/TPS error: reduce prompt size or requested output, schedule work, or request more quota.
- Burst error: use a queue instead of sending a sudden spike.
- Apply bounded exponential backoff with jitter to retryable throttling, and cap both attempts and elapsed time.
Fireworks has separate adaptive token metrics and account quotas. A self-hosted deployment is constrained by its own GPU memory, batch scheduling, concurrency, and gateway policy. Do not reuse Model Studio limits for either route.
Errors and retries
| HTTP status | Likely cause | Recommended action |
|---|---|---|
| 400 | Invalid field, malformed payload, unsupported parameter, or model/mode mismatch | Fix and validate the request. Do not repeat the same invalid payload. |
| 401 | Missing or invalid key, wrong region, wrong workspace, or mismatched base URL | Match the key, workspace, deployment scope, and endpoint. |
| 403 | Service, model, workspace, or account permission is missing | Activate or request the required access; do not blind-retry. |
| 404 | Incorrect endpoint, model ID, workspace, or unsupported compatibility route | Check the regional model list and path. |
| 429 | RPM/RPS, TPM/TPS, account allocation, or burst throttling | Queue and smooth requests; reduce load; retry with bounded backoff and jitter. |
| 500 | Internal service failure | Retry a transient failure with a strict cap; preserve the request ID for support. |
| 503 | Model or service temporarily unavailable | Wait, retry with a cap, and check provider status if the failure persists. |
Safe retry policy
- Retry only transient 429, 500, and 503 failures; treat 400, 401, 403, and 404 as configuration or request defects.
- Use exponential backoff with random jitter, a maximum delay, a maximum attempt count, and an overall deadline.
- Respect request cost: retrying a large generation can consume quota or create duplicate application-side actions.
- Log the HTTP status, provider error code, model ID, region, attempt number, latency, and provider request ID without logging secrets or sensitive prompts.
- Use streaming for long output and set application-level connection and total deadlines.
Pricing
Do not treat one static price as the universal cost of the Qwen API. Model Studio pricing can vary by region, exact model or snapshot, input-length tier, input tokens, cached input, output tokens, Thinking mode, batch processing, and account promotion. Use the official regional pricing table for the exact model ID used by your application.
| Route | How cost is calculated | What to verify |
|---|---|---|
| Model Studio | Provider token pricing and any documented tiers or discounts | Region, model ID, input/output category, context tier, cache, batch, and tax or billing currency |
| Fireworks serverless | Fireworks input, cached-input, and output token pricing | Exact resource path, serverless availability, model-specific row, and account terms |
| Fireworks on-demand | Dedicated deployment and GPU-hour pricing | GPU type and count, replicas, uptime, utilization, and deployment configuration |
| Self-hosted | Infrastructure and operations rather than a hosted per-token list price | GPU purchase or rental, idle capacity, storage, bandwidth, engineering, monitoring, redundancy, and security |
Self-hosting is not free or unlimited. Compare providers with your measured prompt lengths, output lengths, cache hit rate, concurrency, latency target, and utilization—not with a single headline number.
Production checklist
- Choose the provider and region before choosing the base URL and model ID.
- Keep credentials server-side and match the key to its region and workspace.
- Confirm the exact model in the provider’s catalog instead of deriving an ID.
- Use Chat and Responses fields only where that API documents them.
- Validate tool arguments and JSON output before application use.
- Queue traffic, cap retries, and observe token as well as request limits.
- Measure token usage and cost by model, route, tenant, and feature.
- Check the lifecycle table for every production and fallback ID. For Bailian / China Model Studio, remove
qwen-turboandqwen-turbo-realtimebefore October 10, 2026, then test the selected Qwen 3.7 or 3.6 model on the same route and workload. Verify QwenCloud international separately because its current deprecation table does not list Turbo. - Retest pinned code whenever you change the SDK, model alias, region, or provider.
Frequently asked questions
Is there one official Qwen API base URL?
No. Alibaba Cloud Model Studio uses region-specific endpoints, and most regions use a workspace-dedicated hostname. Fireworks and self-hosted servers use different base URLs, keys, model IDs, pricing, and limits.
Is the Qwen API compatible with the OpenAI SDK?
Model Studio documents OpenAI-compatible Chat Completions and Responses endpoints for supported models. Compatibility is not identity: Alibaba-specific fields, supported parameters, model IDs, tool schemas, retention, and modalities still need to be checked.
Is qwen3-max the same as Qwen3-235B-A22B?
No. The official model matrix lists the hosted commercial qwen3-max and the open Qwen3 235B-A22B line separately. Do not infer parameter count, weights, context, or deployment behavior from the other model.
What is the context window of legacy qwen-plus?
The official Model Studio text-model matrix documented qwen-plus with a 1M-token context window on July 21, 2026. The older claim of approximately 131K is not accurate for that alias in the verified matrix.
Is qwen3-14b-think a valid model ID?
It is not a documented Model Studio ID. For the hybrid 14B Chat model where offered, use qwen3-14b and the documented Thinking control. For Responses examples, choose an ID explicitly included in the Responses support list, such as qwen3.7-plus.
Can qwen-plus or qwen3.7-plus be self-hosted?
Do not assume so. These are hosted commercial aliases, and public self-hostable weights are not established merely because the Qwen brand also publishes open checkpoints. For local deployment, choose an explicitly released open-weight checkpoint and follow its own model card and license.
Does Qwen function calling execute my function?
No. The model proposes a tool name and arguments. Your application validates permissions and inputs, executes the function, and sends the result back to the model.
Does the Qwen API have published rate limits?
Yes. Model Studio publishes region- and model-specific RPM and TPM tables and also documents per-second and burst enforcement. Check the official table and your effective account quota rather than assuming one limit applies to every model.
Is the Qwen API free?
Do not assume that production use is free. Free quotas, promotions, eligible models, expiration, and billing terms can differ by provider and account. Review the applicable pricing page and set budget alerts before sending production traffic.
Continue with related Qwen guides
- Compare provider costs and the Qwen3.8 Token Plan boundary in the Qwen API pricing guide.
- Choose a current model in the Qwen models reference.
- Check the legacy identities separately: Qwen Flash, Qwen Turbo, Qwen2.5-Max, and Qwen2.5-VL.
- Compare managed and self-hosted options in the Qwen AI cloud hosting guide.
- For local installation paths, use the Qwen download and local setup guide.
Official documentation
- QwenCloud model selection
- QwenCloud text-model matrix
- QwenCloud model changelog
- QwenCloud model-deprecation table
- QwenCloud qwen-turbo Marketplace card
- QwenCloud qwen3.7-max Marketplace card
- QwenCloud qwen3.7-plus Marketplace card
- QwenCloud qwen3.7-flash Marketplace card
- QwenCloud vision-model matrix
- QwenCloud PAYG list pricing and promotion boundary
- Alibaba Cloud Bailian / China Model Studio lifecycle table
- Alibaba Cloud official Qwen Turbo decommissioning notice
- QwenCloud API keys and base URLs
- QwenCloud Responses API
- QwenCloud Token Plan overview
- Alibaba Cloud Model Studio overview
- Model Studio regions and deployment scopes
- Model Studio base URLs
- Get and manage a Model Studio API key
- Qwen through OpenAI-compatible Chat Completions
- Model Studio Responses API overview
- Model Studio Responses API reference
- Model Studio text-model matrix
- Model Studio visual-model matrix
- Qwen Thinking controls
- Qwen function calling
- Qwen structured output
- Qwen visual-input API guide
- Model Studio rate-limit tables
- Model Studio error codes
- Model Studio model pricing
- Model Studio SDK installation
- Fireworks OpenAI compatibility
- Fireworks Responses API
- Fireworks serverless pricing
- Fireworks serverless rate limits
- vLLM OpenAI-compatible server
- Official Qwen vLLM deployment guide
API behavior, model availability, quotas, and prices can change. Recheck the official regional documentation and provider console before production deployment.

