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 and verified: August 2, 2026.
Verification scope: provider routes, base URLs, model IDs, lifecycle notices, request fields, and code syntax were checked against the official QwenCloud, Alibaba Cloud Model Studio, Fireworks, and vLLM documentation cited below. This site’s public Fireworks chat path was tested on August 2, 2026. No live QwenCloud or Alibaba Model Studio inference request was completed during this review, so this page does not claim live validation of every model, region, tool call, vision flow, or response field. Run a small request with your own route-specific key before production use.
Independence: qwen-ai.chat is an independent informational website. It is not Alibaba Cloud, QwenCloud, the Qwen team, or Fireworks AI.
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 access route before copying an endpoint, model ID, or price. The official QwenCloud and Alibaba Cloud Model Studio routes use different credentials and catalogs, even though both expose OpenAI-compatible interfaces.
| 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 a QwenCloud ID such as qwen3.7-plus | Current official international QwenCloud models billed by tokens | Its key, catalog, pricing, and Responses allowlist are route-specific |
| QwenCloud Token Plan | https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1, a Token Plan key, and an eligible model such as qwen3.8-max-preview | Plan-based access, including the Qwen3.8 preview on the review date | Credits are not a published PAYG dollar-per-token price |
| Alibaba Cloud Model Studio | A regional workspace URL, a matching regional key, and a Model Studio ID such as qwen3.7-plus | Alibaba Cloud deployment scopes, regional billing, and cloud integration | Availability, keys, quotas, and pricing depend on the selected region and workspace |
| Fireworks AI | https://api.fireworks.ai/inference/v1, a Fireworks key, and a full Fireworks resource path | Independent managed serverless or dedicated inference | A library listing does not guarantee serverless availability or identical QwenCloud features |
| Self-hosted vLLM | Your server URL, authentication, and the served open-checkpoint ID or alias | Control over infrastructure, network, and data path | You own capacity, security, scaling, monitoring, upgrades, and operating cost |
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, preview, and legacy Qwen API model IDs
Do not treat one provider’s catalog as a universal model list. The tables below preserve the route and lifecycle state that were documented on August 2, 2026.
QwenCloud current and preview models
| Model ID | Documented context | Status and access |
|---|---|---|
qwen3.8-max-preview | 1M tokens | Preview. Token Plan only on the review date; always-thinking model. No public PAYG USD-per-token price was listed. |
qwen3.7-max | 1M tokens | Current PAYG model for demanding general tasks |
qwen3.7-plus | 1M tokens | Current PAYG balance for text, reasoning, tools, and supported visual input |
qwen3.7-flashqwen3.7-flash-2026-07-15 | Up to 1M tokens, with pricing tiers | Current QwenCloud Flash alias and dated snapshot; released in the QwenCloud changelog on July 25, 2026 |
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 | Legacy alias that Alibaba says will no longer be updated; new work should evaluate Flash or a current Qwen3.7 model | 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; scheduled for Model Studio retirement 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 |
Responses boundary: the QwenCloud Responses documentation lists Qwen3.8 Preview, Qwen3.7 Max, Plus, Flash, the dated Flash snapshot, and selected other models. Legacy qwen-max, qwen-turbo, and Qwen2.5-VL were not on that QwenCloud allowlist when checked. Use Chat Completions or the documented provider-native route where supported, and recheck the exact model page before implementation.
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
| 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 documents Qwen3.8 Preview, Qwen3.7 Max, Plus, Flash, the dated Flash snapshot, and selected other models; Alibaba Cloud Model Studio maintains its own allowlist. Recheck the exact provider reference instead of inferring support from a similar model name.
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.
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.
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.
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.
- 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 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.

