Qwen API Pricing (October 2026): Every Model Price, the 90-Day Free Quota, API Key and Base URL Setup, the Thinking Default That Multiplies Your Bill, Rate Limits and Errors
The Qwen API is Alibaba Cloud Model Studio's pay-as-you-go API for the Qwen models, and it speaks the OpenAI format. You create an API key in the Model Studio console, point any OpenAI SDK at your region's endpoint, and call model names such as qwen3.8-max, qwen-plus or qwen3.8-flash. In the International (Singapore) region on October 22, 2026, qwen3.8-max costs $2 per million input tokens and $6 per million output tokens, qwen-plus $0.40 and $1.20 (for requests up to 256K input tokens), and qwen-flash $0.05 and $0.40. New accounts get a free quota, typically 1 million tokens per model, valid for 90 days. Here is the part almost nobody mentions: the two newest models, qwen3.8-max and qwen3.8-flash, have thinking mode switched on by default. Every call writes a hidden chain of reasoning before the answer, and you pay for those reasoning tokens at the output price. A one-line reply can bill far more output than the line you see. You turn it off with one parameter, enable_thinking: false. Two more details catch people out. Keys only work in their own region, so an example copied from a blog that uses another region's address answers "Incorrect API key provided." And billing starts automatically when the free quota runs out, because the "Free Quota Only" switch is off by default. This page covers every current model and price, thinking mode, tiered pricing, the free quota rules, getting and setting your key, working code for Python, Node.js and curl, rate limits, Qwen Code, and every common error with its exact message.
Jake's shop writes a short repair summary for every job ("screen replaced, battery at 84 percent, tested Wi-Fi and camera"), and Ethan wanted a model to turn the technician's notes into a friendly message for the customer. He had run Qwen locally and wanted the hosted API for the shop's small server, so he signed up for Model Studio in the Singapore region, copied an example from a blog, and got "Incorrect API key provided." on the first call. "Did they reject the shop?" Jake asked. "No. The example was for Beijing, and our key is a Singapore key," Ethan said, comparing the address in the example with the one his key's dialog had shown. This page is what he found, plus the two switches he flipped before the first customer message went out.
New to Qwen? Qwen is the family of large language models built by Alibaba, with open-weight versions you can run on your own PC and hosted versions you call over the internet. The hosted ones are sold through Alibaba Cloud Model Studio, which was once branded DashScope and is called Bailian in Chinese. That history is why the API key variable is still DASHSCOPE_API_KEY, why the Python SDK is named dashscope, and why some tools label the provider "Bailian". Some Qwen models are also on Amazon Bedrock (our Bedrock model ID list has them). This page is about Model Studio's own API.
Qwen API prices, October 2026
Here are the standard pay-as-you-go prices in the Singapore region with the International deployment scope, per million tokens, on October 22, 2026. The console may show temporary promotions on top. Where a model has two output prices, the second is for thinking mode.
| Model | Input tokens per request | Input | Output |
|---|---|---|---|
qwen3.8-max | up to 1M | $2.00 | $6.00 (thinking on by default) |
qwen3.7-max | up to 1M | $2.50 | $7.50 |
qwen-max | no tiers (non-thinking only) | $1.60 | $6.40 |
qwen3.7-plus | up to 256K / 256K to 1M | $0.40 / $1.20 | $1.60 / $4.80 (list price; a 20% promotion was running) |
qwen3.6-plus | up to 256K / 256K to 1M | $0.50 / $2.00 | $3.00 / $6.00 |
qwen3.5-plus | up to 256K / 256K to 1M | $0.40 / $0.50 | $2.40 / $3.00 |
qwen-plus | up to 256K | $0.40 | $1.20 / $4.00 thinking |
qwen-plus | 256K to 1M | $1.20 | $3.60 / $12.00 thinking |
qwen3.8-flash | up to 1M | $0.15 | $0.47 (thinking on by default) |
qwen3.7-flash | up to 32K / 32K to 256K / 256K to 1M | $0.03 / $0.10 / $0.20 | $0.13 / $0.40 / $0.80 |
qwen3.6-flash | up to 256K / 256K to 1M | $0.25 / $1.00 | $1.50 / $4.00 |
qwen3.5-flash | up to 1M | $0.10 | $0.40 |
qwen-flash | up to 256K / 256K to 1M | $0.05 / $0.25 | $0.40 / $2.00 |
qwen3-coder-flash | up to 32K / 128K / 256K / 1M | $0.30 / $0.50 / $0.80 / $1.60 | $1.50 / $2.50 / $4.00 / $9.60 |
qwen3-vl-plus (vision) | up to 32K / 128K / 256K | $0.20 / $0.30 / $0.60 | $1.60 / $2.40 / $4.80 |
qwen-vl-ocr | no tiers | $0.07 | $0.16 |
Image models are priced per image. qwen-image-2.1-turbo costs $0.016 and qwen-image-2.1-pro $0.04 per image, with 10 free images each for new accounts. Our Qwen-Image 2.1 Turbo guide covers running that model locally instead. Model Studio also hosts other companies' models, such as DeepSeek, GLM and Kimi, at their own prices (see the comparison below).
If you are looking for qwen-turbo or qwen-turbo-latest, which many older tutorials use, it is no longer listed for the International region as of October 22, 2026. For new projects, qwen-flash and the qwen3.x-flash models are the low-cost, fast options. If you searched for "Qwen 3.5 Plus API" or "Qwen 3.6 Plus API", both are still listed and callable. For requests up to 256K tokens, the newer qwen3.7-plus costs the same per input token as qwen3.5-plus and less per output token, so it is the better choice for new code. Above 256K, qwen3.5-plus is cheaper.
Thinking mode: the default that multiplies your output bill
Many Qwen models are "hybrid thinking" models. Before answering, they can write out a chain of reasoning, which the API returns in a separate reasoning_content field, and then the answer in the usual content field. The reasoning improves hard answers (math, planning, tricky code), and it is billed as output tokens. Model Studio's price list labels that output column "chain of thought + answer".
Which models do it by default is the part that matters:
- Thinking on by default: qwen3.8-max, qwen3.8-flash, qwen3.7-max, qwen3.7-plus, qwen3.7-flash, qwen3.6-plus, qwen3.6-flash, qwen3.5-plus and qwen3.5-flash, plus the hosted DeepSeek V4.1 Flash and GLM-5 models.
- Thinking off by default: qwen-plus and qwen-flash (and their dated snapshots), and the Kimi K2.5 and K2.6 models.
So if you move a working app from qwen-plus to qwen3.8-flash because the input price looks lower, your output token count can jump, because the new model now reasons before every reply. For a task like Jake's, a two-sentence customer message, the reasoning is wasted money. Turn it off per request. The parameter is not part of the OpenAI standard, so the OpenAI SDKs pass it through extra_body:
# Python, OpenAI SDK
reply = client.chat.completions.create(
model="qwen3.8-flash",
messages=[{"role": "user", "content": "Write a two-line thank-you note for a repair customer."}],
extra_body={"enable_thinking": False}, # no hidden reasoning tokens
)
// Node.js, OpenAI SDK: extra fields go straight in the body
const reply = await client.chat.completions.create({
model: "qwen3.8-flash",
messages: [{ role: "user", content: "Write a two-line thank-you note." }],
enable_thinking: false,
});
# curl: add it to the JSON body
"enable_thinking": false
Keep thinking on where it earns its cost: multi-step reasoning, debugging, long analysis, agent planning. Leave it off for rewriting, classification, extraction, short replies and chat. Check the result by printing usage. With thinking on, the completion token count includes the reasoning, which you never show the user but always pay for. "So the model was talking to itself on our dime?" Jake asked. "Only until I told it not to," Ethan said.
If you want some reasoning but not an unlimited amount, add thinking_budget with a maximum number of reasoning tokens (Model Studio's Node.js example uses 50 next to enable_thinking: true). Some models are thinking-only (they always reason and the parameter does nothing), and the omni models adjust effort with reasoning_effort instead. If a request fails with InvalidParameter.NotSupportEnableThinking ("The model xxx does not support enable_thinking."), the model you called does not accept the switch. Remove the parameter or pick a hybrid model.
How tiered pricing works (and why long prompts cost more per token)
Several models use tiered pricing. The price per token depends on how many input tokens a single request has, and all tokens in that request are billed at that tier's price, not just the ones above the threshold. Here is what that means for qwen-plus:
- A request with 200,000 input tokens and 2,000 output tokens is in the up-to-256K tier: 0.2 × $0.40 + 0.002 × $1.20 = $0.08 + $0.0024 = $0.0824.
- A request with 300,000 input tokens and 2,000 output tokens is in the 256K-to-1M tier, so every token costs the higher rate: 0.3 × $1.20 + 0.002 × $3.60 = $0.36 + $0.0072 = $0.3672.
That second request has only 50 percent more input but costs about 4.5 times as much. If you feed long documents, check where your typical request lands. You might split a 300K-token job into two requests under 256K each, or use retrieval to send only the relevant parts. Short chat-style requests sit far below every threshold, so you simply pay the first tier.
Tiers also differ per model. qwen3.7-flash has its first boundary at 32K, so a chatbot that carries a long conversation history can drift from $0.03 to $0.10 per million input tokens as the history grows past 32K tokens. Trimming old turns keeps you in the cheapest tier. qwen3.8-max and qwen3.8-flash have a single tier up to 1M tokens, which makes their bills easy to predict.
Context caching and batch: two ways to pay less
Context caching helps when many requests share the same long beginning, such as a system prompt, a product manual or a codebase summary. On models that support it, input tokens served from an explicit cache are billed at 10 percent of the standard input price, and creating that cache is billed once at 125 percent. A 20,000-token manual sent with every request is the classic case: after the first request, most of those tokens cost a tenth as much. Put the shared part at the start of the prompt and keep it byte-for-byte identical. Any change near the beginning breaks the match.
Batch inference halves the price of both input and output on models that support it, including qwen-flash, qwen3.5-flash, qwen3.6-flash and qwen3.7-flash. You submit the work as a file instead of live requests and collect the results later. Nightly jobs, such as summarizing the day's repair notes or tagging a week of support tickets, are a natural fit. Batch calls to qwen-plus, qwen-flash and qwen-max are also not subject to the per-minute rate limits. The two discounts do not stack: a batch request gets 50 percent off, but not the cache discount on top.
The free quota: how much, how long, and the switch to turn on
When you first activate Model Studio in the Singapore region, you get a free quota on many models. The price list usually shows 1 million tokens per model (image models count images instead). These rules matter:
- Only Singapore-region, International-scope models come with the free quota. Other regions have none.
- It lasts 90 days from whichever is latest: when you activated Model Studio, when the model was released, or when your access request for it was approved. Unused quota simply expires.
- It is per model, so tokens on
qwen-plusdo not reduce your quota onqwen-flash. Trying five models gives you five separate allowances. - It is shared by your Alibaba Cloud account and its RAM users (sub-users) for each model.
- You must complete your account information before activating Model Studio (required since September 15, 2026). The quota covers model inference only, not fine-tuning, deployment or storage.
- When it runs out, billing starts automatically unless you turned on Free Quota Only (the "worry-free" mode), which stops the service instead. It is off by default. With it on, calls after the quota is gone fail with HTTP 403
AllocationQuota.FreeTierOnly. - The console's remaining-quota figure refreshes every minute, so refresh the page before deciding the quota is gone.
Turning on Free Quota Only was the first thing Ethan did after creating the account. "So the free trial cannot turn into a bill while we sleep?" Jake asked. "Not unless I switch it off on purpose," Ethan said. Once you decide to pay, turn it off and set a fee alert in the billing console (see keeping the bill under control).
If you searched for a "free Qwen API key" and found keys posted on GitHub or forums, skip them. A key that works is someone else's billing account. It gets revoked when they notice, and anything you send through it is visible to its owner. The real free routes are your own 90-day quota and, for unlimited free use, the open-weight models on your own hardware.
Get a Qwen API key, step by step
- Create or sign in to an Alibaba Cloud account, complete the account information, and activate Model Studio. Open the Model Studio console, read and agree to the terms, and the service activates.
- Open the Model Studio API Key page and choose the region in the top-right corner. Choose Singapore for the free quota.
- Choose Create API Key. Pick the workspace (the default one is fine to start), add a description, and choose Permissions: All, or Custom to restrict the key to certain models and up to 20 IP addresses or CIDR blocks.
- Copy the API key and the API Host (the endpoint) from the dialog and store them safely. The full key is shown only once. If you lose it, reset it or create another.
- Save the key as the
DASHSCOPE_API_KEYenvironment variable (next section) instead of writing it in code.
Keys belong to a region. A Singapore key does not work against the Virginia or Beijing endpoints, and each region has its own model list. Model Studio keys start with sk-. Token Plan and Coding Plan subscriptions use a separate key that starts with sk-sp- and only works with that plan's own base URL. Mixing a plan key with the general endpoint, or a general key with a plan endpoint, returns an authentication error. Our OpenAI API key guide covers keeping keys out of code and logs, and the same habits apply here.
Set DASHSCOPE_API_KEY on Windows, macOS and Linux
Every official example reads the key from DASHSCOPE_API_KEY. Setting it once means your code never contains the key and you can share scripts safely.
- Find your shell on macOS or Linux: run
echo $SHELL. If it ends inzsh(the macOS default), you will edit~/.zshrc. If it ends inbash, you will edit~/.bashrc(or~/.bash_profileon older Macs). - Add the variable permanently:
echo "export DASHSCOPE_API_KEY='sk-...'" >> ~/.zshrc(or~/.bashrc), then runsource ~/.zshrcto load it. - On Windows (Command Prompt): run
setx DASHSCOPE_API_KEY "sk-...", then close and reopen the window.setxsaves the value for new windows only, which is why the same window still shows nothing. - On Windows (PowerShell, current window only):
$env:DASHSCOPE_API_KEY = "sk-...". This lasts until you close the window, which is handy for a quick test. - Check it:
echo $DASHSCOPE_API_KEYon macOS and Linux,echo %DASHSCOPE_API_KEY%in Command Prompt, orecho $env:DASHSCOPE_API_KEYin PowerShell. You should see your key, not a blank line.
One mistake shows up again and again in support threads. Writing api_key=os.getenv("sk-abc123...") passes the key as the name of a variable to look up, finds nothing, and sends no key. Pass the variable name instead: os.getenv("DASHSCOPE_API_KEY"). If you start your code from an editor or a service manager, it may not see variables from your shell profile. Restart the editor after setting the key, or set the variable in the service's own configuration (a systemd Environment= line, a Docker -e flag, or your host's secrets settings).
Endpoints by region, and the old dashscope domains
For the OpenAI-compatible API, set the SDK's base URL to your region's endpoint, with your workspace ID in the host name:
| Region | OpenAI-compatible base URL | Older domain |
|---|---|---|
| Singapore | https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1 | dashscope-intl.aliyuncs.com |
| US (Virginia) | https://{WorkspaceId}.us-east-1.maas.aliyuncs.com/compatible-mode/v1 | - |
| Hong Kong (China) | https://{WorkspaceId}.cn-hongkong.maas.aliyuncs.com/compatible-mode/v1 | cn-hongkong.dashscope.aliyuncs.com |
| Japan (Tokyo) | https://{WorkspaceId}.ap-northeast-1.maas.aliyuncs.com/compatible-mode/v1 | - |
| China (Beijing) | https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/compatible-mode/v1 | dashscope.aliyuncs.com |
Replace {WorkspaceId} with your workspace ID, shown in the console and in the API Host when you create the key. For direct HTTP calls, append /chat/completions. Alibaba is moving everyone from the older shared domains to these workspace-specific ones and describes the new ones as faster and more stable. The old Singapore domain still answered on October 22, 2026, but new code should use the new addresses.
Most first-call failures come from the URL, and each mistake gives a different reply, which makes them quick to diagnose:
- Another region's address (a Beijing example with a Singapore key, which was Ethan's mistake) returns HTTP 401 with "Incorrect API key provided." and code
invalid_api_key. The key is fine; it is in the wrong building. - The placeholder left in (a literal
YOUR_WORKSPACE_IDor{WorkspaceId}in the host name) returns HTTP 400 with "Workspace endpoint is invalid." - A typo in the path, such as
/chat/completionwithout the final s, returns HTTP 404 with an empty body. - No Authorization header at all returns HTTP 401 with "You didn't provide an API key. You need to provide your API key in an Authorization header using Bearer auth."
Call the Qwen API: Python, Node.js and curl
In Python 3.9 or later, install the OpenAI SDK (pip install -U openai) and point it at Model Studio:
import os
from openai import OpenAI
client = OpenAI(
api_key=os.getenv("DASHSCOPE_API_KEY"),
base_url="https://YOUR_WORKSPACE_ID.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1",
)
reply = client.chat.completions.create(
model="qwen-plus",
messages=[
{"role": "system", "content": "You turn technician notes into a short, friendly message for a phone repair customer."},
{"role": "user", "content": "screen replaced, battery 84%, wifi+camera tested ok"},
],
)
for choice in reply.choices:
print(choice.message.content)
print(reply.usage) # prompt_tokens and completion_tokens: what you are billed for
If DASHSCOPE_API_KEY is not set, the OpenAI SDK stops with "Missing credentials. Please pass an `api_key` ... or set the `OPENAI_API_KEY` ... environment variable." That message mentions OpenAI only because it is the OpenAI library. You do not need an OpenAI key. It means your DASHSCOPE_API_KEY was empty in the process that ran the code.
In Node.js (npm install openai):
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.DASHSCOPE_API_KEY,
baseURL: "https://YOUR_WORKSPACE_ID.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1",
});
const reply = await client.chat.completions.create({
model: "qwen3.8-flash",
enable_thinking: false,
messages: [{ role: "user", content: "Write a two-line thank-you note for a repair customer." }],
});
for (const choice of reply.choices) console.log(choice.message.content);
And with curl:
curl --location "https://YOUR_WORKSPACE_ID.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1/chat/completions" \
--header "Authorization: Bearer $DASHSCOPE_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"model": "qwen3.8-max",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Explain battery health in one sentence."}
]
}'
Streaming works the usual OpenAI way: stream=True in Python, stream: true in Node.js and curl. With a thinking model, the streamed chunks carry reasoning_content first and then content, so print only content if you do not want to show the reasoning. Print usage while you develop. It shows exactly how many input and output tokens each call used, and it is the fastest way to check your cost estimate against reality.
The DashScope Python SDK (the native alternative)
Model Studio also has its own SDK, dashscope, which its guides call the recommended option. You only need it for features outside the OpenAI format, because the OpenAI SDK covers ordinary chat. Install it with pip install -U dashscope (Python 3.9 or later; inside a virtual environment, activate it first, or you will see No module named 'dashscope' when the script runs under a different Python). Set the base URL for your region at the top of the script. Note that it ends in /api/v1, not /compatible-mode/v1:
import os
import dashscope
from dashscope import MultiModalConversation
dashscope.base_http_api_url = "https://YOUR_WORKSPACE_ID.ap-southeast-1.maas.aliyuncs.com/api/v1"
response = MultiModalConversation.call(
api_key=os.getenv("DASHSCOPE_API_KEY"),
model="qwen3.8-max",
messages=[
{"role": "system", "content": [{"text": "You are a helpful assistant."}]},
{"role": "user", "content": [{"text": "Who are you?"}]},
],
)
if response.status_code == 200:
for choice in response.output.choices:
for part in choice.message.content:
print(part["text"])
else:
print(response.status_code, response.code, response.message)
Two differences from the OpenAI style trip people up. Model Studio's own example calls qwen3.8-max through MultiModalConversation, with each message's content as a list of parts. And the SDK reports errors in the response (status_code, code, message) instead of always raising an exception, so check status_code. If the key is missing, version 2.0.1 of the SDK raises "No api key provided. You can set by dashscope.api_key = your_api_key in code, or you can set it via environment variable DASHSCOPE_API_KEY= your_api_key." That is the same fix as above: set the variable, or pass api_key=. Anything built on the dashscope SDK picks up the same variable, because the SDK reads it itself.
JSON output and function calling
JSON mode makes the model return valid JSON, which matters when code reads the answer. Set response_format to {"type": "json_object"}, and make sure the word "JSON" appears somewhere in your system or user message. If it does not, the API refuses with "'messages' must contain the word 'json' in some form, to use 'response_format' of type 'json_object'." For a fixed structure, use {"type": "json_schema", "json_schema": {...}} with "strict": true, and the output follows your schema. Thinking mode and JSON do not always mix well. Some models accept json_object with thinking on but can return text that is not strictly valid JSON, so turn thinking off for extraction jobs.
reply = client.chat.completions.create(
model="qwen-plus",
response_format={"type": "json_object"},
messages=[
{"role": "system", "content": "Extract device, fault and price from the note. Reply in JSON with keys device, fault, price_usd."},
{"role": "user", "content": "iPhone 15, cracked back glass, quoted 129 dollars"},
],
)
Function calling (tool calling) uses the standard OpenAI tools parameter. You describe your functions with a JSON schema, the model replies with a tool call and its arguments, your code runs the function, and you send the result back in a tool message. tool_choice forces or blocks a particular tool. When one question needs several calls at once (the weather in three cities, say), set parallel_tool_calls to true, or the model may return only the first call. Because the format matches OpenAI's, agent frameworks that already support OpenAI tools work with Qwen once you change the base URL and model name.
Which Qwen model should you use? (and what the version names mean)
qwen-flashorqwen3.7-flashare the cheapest for high volumes of simple work, such as classification, short replies, extracting fields and summarizing notes. At $0.03 to $0.05 per million input tokens for short requests, cost stops being a concern. Remember that qwen3.7-flash thinks by default and qwen-flash does not.qwen3.8-flashis the newest fast model, a step up in quality for a few cents more. Turn thinking off for simple tasks.qwen-plusorqwen3.7-plusare the balanced defaults for most applications. qwen-plus answers directly unless you ask it to think. qwen3.7-plus thinks by default and charges the same output price either way.qwen3.8-maxis the most capable, for complex reasoning, long documents and agent work, at $2 and $6.qwen3-coder-flashis tuned for code and priced in four tiers by prompt length.qwen3-vl-plusandqwen-vl-ocrread images: general vision questions, and cheap text extraction from scans and photos.
Model names come in three kinds, and the difference affects both behavior and rate limits. A stable name like qwen-plus points at a current snapshot (on October 22, 2026, qwen-plus was "currently equivalent to" qwen-plus-2025-12-01) and moves to newer ones over time. Some models also have a -latest alias, such as qwen-plus-latest, which moves too. A dated snapshot like qwen-plus-2025-07-14 never changes, which is good for reproducible output. However, it usually has much lower rate limits and is eventually retired. Calling a retired snapshot returns HTTP 403 "Workspace endpoint access denied." (Endpoint.AccessDenied). For most apps, use the stable name. Pin a snapshot only when you need the same output for months and can watch for its retirement notice.
A practical approach is to build with qwen-plus, measure quality on 20 real examples, then try the same examples on a flash model with thinking off. If the cheaper model is good enough, you have cut the bill by 80 to 90 percent. If not, you know exactly what the extra quality costs. Jake's repair messages are short and formulaic, which is exactly the kind of job a flash model is built for, so qwen3.8-flash is the one Ethan kept.
Qwen API rate limits
Model Studio limits requests per minute (RPM) and tokens per minute (TPM, input plus output) for each model. The limits are counted across your whole Alibaba Cloud account: every RAM user, workspace and API key under it shares one allowance. A second key does not give you a second limit. Singapore, International scope, October 22, 2026:
| Model | Requests per minute | Tokens per minute |
|---|---|---|
qwen3.8-max, qwen3.8-flash | Dynamic rate limiting (no fixed number published) | |
qwen3.7-max | 600 | 1,000,000 |
qwen3.7-plus, qwen3.6-plus, qwen3.5-plus | 15,000 | 5,000,000 |
qwen3.7-flash, qwen3.6-flash, qwen3.5-flash | 15,000 | 5,000,000 |
qwen-plus, qwen-plus-latest | 600 | 1,000,000 |
qwen-flash | 600 | 5,000,000 |
qwen-max | 600 | 1,000,000 |
Dated snapshots, e.g. qwen-plus-2025-07-14 | often 60 | 100,000 to 1,000,000 |
Two things the numbers hide. First, limits can also be enforced per second, at RPM divided by 60. A burst of 50 requests in one second can be rejected even though 50 a minute is far below 600. Second, a sudden spike can trigger stability protection on its own, even below both limits. The message tells you which limit you hit:
- "Requests rate limit exceeded" or "You exceeded your current requests list" means you sent too many requests. Slow down.
- "Allocated quota exceeded" or "You exceeded your current quota" means you sent too many tokens per minute. Shorten prompts or cap the output length. Despite the wording, this is not about the free quota or your balance.
- "Request rate increased too quickly" means your traffic spiked. Spread requests evenly with a queue or exponential backoff.
All three come back as HTTP 429. Topping up your balance does not raise them, because limits are set per account and are separate from billing. Higher limits need a request to your Alibaba Cloud business manager. The practical fixes are cheaper. Use the stable model name (snapshots have lower limits), send background work through the Batch API (not rate limited for qwen-plus, qwen-flash and qwen-max), and fall back to a second model when the first returns 429, for example qwen-plus first and qwen-flash on retry. Model Studio's own guide suggests exactly that fallback. A rejected request is simply refused. It does not slow down the requests that get through.
Worked cost examples
Jake's shop: 40 repair messages a day, each about 300 input tokens (system prompt plus notes) and 80 output tokens, on qwen3.8-flash with thinking off. A 30-day month is 1,200 requests. That is 360,000 input tokens × $0.15 per million = $0.054, plus 96,000 output tokens × $0.47 per million = $0.045. The total is about 10 cents a month, well inside the free quota for the first three months.
The same shop with thinking left on: suppose each reply carried 600 tokens of hidden reasoning. Output becomes 1,200 × 680 = 816,000 tokens, and the month costs about 44 cents instead of 10 on qwen3.8-flash. That is still small, but more than four times the bill for identical messages. On qwen3.8-max the same pattern turns $1.30 a month into about $5.60. For a business sending 10,000 messages a day instead of 40, that one switch is the difference between about $325 and $1,400 a month on qwen3.8-max.
A support assistant: 2,000 conversations a day, each 4,000 input tokens (a 3,000-token knowledge prompt plus 1,000 tokens of conversation) and 400 output tokens, on qwen-plus. Without caching, the day costs 8M input × $0.40 = $3.20 plus 0.8M output × $1.20 = $0.96, so $4.16 a day or about $125 a month. With the 3,000-token prompt served from an explicit cache at 10 percent, input drops to 2M × $0.40 + 6M × $0.04 = $1.04 a day, and the month comes to about $60.
Long document analysis: 100 contracts a day at 300,000 tokens each on qwen-plus lands in the 256K-to-1M tier at $1.20 per million input, so 30M × $1.20 = $36 a day. If each contract can be split into two 150K-token halves, both land in the first tier at $0.40, and input costs about $12 a day. Designing around tier boundaries pays off.
Qwen API vs DeepSeek API pricing, and Qwen on OpenRouter
Model Studio also hosts DeepSeek, so you can compare the two on the same bill with the same key. DeepSeek V4.1 Flash there uses peak and off-peak prices. Busy hours run from 08:00 to 22:00 in UTC+8 (that is 00:00 to 14:00 UTC), and idle hours are the rest of the day. The table shows the cost of 1,000 requests of 2,000 input and 500 output tokens each:
| Model on Model Studio (Singapore) | Input / output per 1M | 1,000 requests |
|---|---|---|
qwen-flash | $0.05 / $0.40 | $0.30 |
qwen3.8-flash (thinking off) | $0.15 / $0.47 | $0.54 |
deepseek-v4.1-flash, idle hours | $0.15 / $0.60 | $0.60 |
deepseek-v4.1-flash, busy hours | $0.30 / $1.20 | $1.20 |
qwen-plus | $0.40 / $1.20 | $1.40 |
qwen3.8-max (thinking off) | $2.00 / $6.00 | $7.00 |
On price alone, the Qwen flash models beat DeepSeek V4.1 Flash at any hour, and qwen-plus costs slightly more than DeepSeek's busy-hour price. DeepSeek V4.1 Flash also thinks by default, so the same enable_thinking advice applies to it. Quality depends on your task, so run your 20 real examples through both. Our DeepSeek V4.1 Flash guide covers DeepSeek's own API and prices.
OpenRouter also resells Qwen models through one OpenAI-compatible key. On October 22, 2026 it listed 43 Qwen models, with qwen/qwen3.8-flash at the same $0.15 and $0.47 and qwen/qwen3.8-max-0902 at $2 and $6. None of the Qwen models was free that day. OpenRouter makes sense if you already use it for other providers and want one bill. Go direct to Model Studio if you want the 90-day free quota, context caching, batch discounts and the newest models first.
Qwen Code: using your API key in the terminal and VS Code
Qwen Code is a terminal coding assistant, similar in spirit to other AI coding command-line tools, that can run on your Model Studio key. Searches for "Qwen Code API key" usually come from people stuck on its setup, which goes like this:
- Install it. On macOS or Linux, run Alibaba's install script,
bash -c "$(curl -fsSL https://qwen-code-assets.oss-cn-hangzhou.aliyuncs.com/installation/install-qwen.sh)" -s --source bailian. On Windows, the same guide gives a.batinstaller to run in an administrator Command Prompt. Then reopen the terminal and check withqwen --version. - Connect your key. Start
qwenin a project folder and type/auth. Choose Use your own API Key > Standard API Key, pick your region, and paste your Model Studio key. Coding Plan and Token Plan subscribers choose their plan instead and paste thesk-sp-key. - Or configure it by file. Settings live in
~/.qwen/settings.json(on Windows,C:\Users\<you>\.qwen\settings.json). UndermodelProvidersand thenopenai, each model entry has anidsuch asqwen3.8-max, abaseUrl(your region's workspace endpoint for a standard key), and anenvKeynaming the environment variable that holds the key. Alibaba's sample usesBAILIAN_API_KEYin anenvblock of the same file. - Use it in VS Code or JetBrains. In VS Code 1.85.0 or later, install Qwen Code Companion from the Extensions Marketplace. It shares the same
settings.json, so there is nothing more to set. JetBrains IDEs connect through a custom agent that runsqwen --acp.
Plan keys need plan addresses. The Coding Plan base URL is https://coding-intl.dashscope.aliyuncs.com/v1, and Token Plan uses https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1. A plan key on the standard endpoint, or the reverse, fails authentication. Some models, such as qwen3.8-max-preview, are only for Token Plan subscribers and return 403 access_denied with a general key. On a standard pay-as-you-go key, Qwen Code's calls draw on the same per-model free quota as any other call. Coding agents send large contexts, so expect them to use it up much faster than a chat app would.
Using the Qwen API in other tools
Because the API is OpenAI-compatible, most tools that let you set a custom OpenAI base URL and key can use Qwen. That includes chat front ends, coding assistants such as Cline that accept "OpenAI-compatible" providers, LangChain's OpenAI chat class, workflow builders like Dify, and agent frameworks. Configure three things: the base URL for your region (with your workspace ID), the API key, and the exact model name, such as qwen3.8-max. If a tool insists on its own list of model names, look for a "custom model" field. Model Studio also offers an Anthropic-compatible Messages endpoint for tools built around that format. Features beyond plain chat completions, such as some tool-calling formats and special parameters, can differ between tools. Test with a simple request first, and add enable_thinking wherever the tool lets you pass extra body fields.
API, local, or Bedrock?
You have three ways to run Qwen, and each suits different needs:
- The Model Studio API gives you the newest and largest models with no hardware, paid per token. It is best for production apps and the biggest models.
- Running locally with the open-weight models is free per token, private and offline, but limited by your GPU or Mac's memory. Our guides cover Qwen3.8, Qwen3.8 Flash Next and Qwen3.8 27B on an 8 GB GPU.
- Amazon Bedrock runs selected Qwen models inside your AWS account, with AWS billing and IAM, and your data stays in AWS. It is best if you already run on AWS and want one bill and one security model.
Many teams mix them. They prototype locally for free, ship on the API for reliability, and keep a local model as a fallback for the day the internet connection or the budget runs out. Prompts move between them with few changes, because local servers like Ollama and LM Studio also speak the OpenAI format. Mostly you change the base URL and the model name.
Keeping the bill under control
A few settings take five minutes and prevent nearly every surprise bill:
- Free Quota Only during the trial, as above. Switch it off on the day you decide to pay, not before.
- Fee alerts and a budget. In the Bills and fees card, set fee alerts, enable a monthly consumption limit, and configure threshold notifications. On the Budget Management page you can also turn on Stop Service When Budget Reached. Once that budget is used up, calls fail with HTTP 429
BudgetLimitExceededinstead of running up the bill. The stop takes effect after a short delay, and anything used during that delay is still billed. - Custom key permissions. Limit each key to the models it needs and to your server's IP addresses. A leaked key that only works for qwen-flash from one IP address is a minor problem, not a disaster.
- Thinking off wherever you do not need reasoning, and max_tokens set on every request, so a runaway reply cannot write 20,000 tokens.
- Watch usage weekly. The console's Monitoring page shows calls and tokens per model, updated every minute. These numbers are for reference, and your bill is the source of truth.
If your balance runs out on pay-as-you-go, calls fail with Arrearage (HTTP 400) or PostpaidBillOverdue (HTTP 429, "The postpaid bill is overdue.") until you pay. Clients such as coding tools sometimes show these as vague errors, so check the billing page when every call fails at once.
Common Qwen API errors and their exact messages
- 401
invalid_api_key, "Incorrect API key provided." or "Invalid API-key provided." The key is wrong, was reset, was copied with a space or line break, belongs to another provider, belongs to another region than the endpoint, or is ask-sp-plan key used on the general endpoint. Match the key's region to the URL first, since that is the most common cause. - 401, "You didn't provide an API key." No Authorization header was sent, usually because the environment variable was empty. Check it with
echoin the same terminal that runs your code. - 400, "Workspace endpoint is invalid." The base URL still contains the workspace placeholder, or the wrong workspace ID. Copy the API Host from the console.
- 403
AccessDenied.Unpurchased, "Access to model denied. Please make sure you are eligible for using the model." Model Studio is not activated for this account, or sign-up is incomplete. Finish account information and activate it in the console. - 403
AllocationQuota.FreeTierOnly, "The free tier of the model has been exhausted." The free quota for that model is used up or expired, and Free Quota Only is on. Turn it off to continue on pay-as-you-go. New users who have not completed sign-up can see it too. - 403
Model.AccessDenied, "Model access denied." A key from a sub-workspace has not been granted that model. Grant model calling permission to the workspace, or use a default-workspace key. - 403
Endpoint.AccessDenied, "Workspace endpoint access denied." The model, usually an old dated snapshot, has been retired. Switch to the stable name or the recommended replacement. - 404
model_not_found, "The model xxx does not exist or you do not have access to it." The model name is misspelled or not available in your region. Model lists differ between regions, so copy the name from the model list for yours. - 404
model_not_supported, "Unsupported model xxx for OpenAI compatibility mode." That model only works through the native DashScope API. Use thedashscopeSDK for it. - 400, "'messages' must contain the word 'json'..." You set JSON mode without saying "JSON" in the prompt. Add the word.
- 429
Throttling.RateQuotaorThrottling.AllocationQuotameans the requests-per-minute or tokens-per-minute limit was hit. Back off and retry, and see rate limits. - 500
InternalErroror 503ModelUnavailableis a temporary server-side problem. Retry with backoff, and fall back to another model if it persists.
Qwen API troubleshooting, by symptom
An example from a tutorial fails immediately
It targets another region or the old shared domain while your key is from a different region. Use the API Host from your own key's dialog.
My bill is higher than my token estimate
Thinking mode is probably on. qwen3.8-max, qwen3.8-flash and the 3.5 to 3.7 series reason by default. Send enable_thinking false for simple tasks.
My free quota disappeared before I used it
It expires 90 days after activation, model release or approval, whichever is latest, whether or not you used it. Plan trials within that window.
I was billed although I thought I was on the free tier
The quota ran out or expired and Free Quota Only was off, which is the default. Turn it on to stop at the end of the quota.
I cannot find qwen-turbo in the console
It is no longer listed for the International region. Switch to qwen-flash or a qwen3.x-flash model, which are the low-cost options now.
Long requests cost far more than short ones
Tiered pricing bills every token at the tier of the request's total input. Keep requests under the tier boundary, such as 256K for qwen-plus.
I get 429 errors at low volume
Bursts are limited per second too, at RPM divided by 60, and dated snapshots often allow only 60 RPM. Spread requests out and use the stable model name.
The code works in my terminal but not in my app or service
The service does not see your shell's DASHSCOPE_API_KEY. Set the variable in the service, container or editor configuration and restart it.
Qwen API: frequently asked questions
How much does the Qwen API cost?
In the International (Singapore) region in October 2026, qwen3.8-max is $2 per million input and $6 per million output tokens, qwen-plus $0.40 and $1.20, and qwen-flash $0.05 and $0.40 for requests up to 256K tokens.
Is the Qwen API free?
New Singapore-region accounts get a free quota, usually 1 million tokens per model, valid for 90 days. After that, usage is billed pay-as-you-go unless Free Quota Only is on.
Does Qwen have an API?
Yes. Alibaba Cloud Model Studio sells the Qwen models through an OpenAI-compatible API and its own DashScope API, and some Qwen models are also on Amazon Bedrock and OpenRouter.
How do I get a Qwen API key?
Activate Alibaba Cloud Model Studio, open the API Key page, pick a region, and choose Create API Key. Copy the key and API Host right away, because the key is shown once.
Is the Qwen API OpenAI compatible?
Yes. Set the OpenAI SDK's base_url to your region's compatible-mode endpoint and its api_key to your DASHSCOPE_API_KEY, then use Qwen model names.
What is the Qwen API base URL?
For Singapore, https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1 with your workspace ID. Other regions have their own domains.
What is DASHSCOPE_API_KEY?
It is the environment variable that holds your Model Studio API key. DashScope is the service's former name, so the SDKs and examples still read this variable.
Why does my Qwen API bill include so many output tokens?
Thinking mode is on by default for qwen3.8-max, qwen3.8-flash and the 3.5 to 3.7 models, and the reasoning is billed as output. Set enable_thinking to false.
What is the Qwen API rate limit?
It depends on the model and is shared across your whole account. qwen-plus allows 600 requests and 1 million tokens per minute, and the qwen3.x plus and flash models allow 15,000 and 5 million.
What is the difference between qwen-plus and qwen-max?
qwen-plus is the balanced, cheaper model that answers directly unless asked to think. The max models are the most capable and cost more, and qwen3.8-max is the newest.
What happened to qwen-turbo?
It is no longer listed for the International region in October 2026. qwen-flash and the qwen3.x-flash models are the fast, low-cost choices now.
What is Free Quota Only in Model Studio?
It is a setting that stops service when your free quota is exhausted instead of switching to paid usage. It is off by default.
Can a Singapore API key be used in the US region?
No. Each region has its own API keys, endpoint and model list, and a key used against another region's endpoint returns Incorrect API key provided.
Is Qwen cheaper than DeepSeek?
On Model Studio in October 2026, qwen-flash and qwen3.8-flash cost less than DeepSeek V4.1 Flash at any hour, and qwen-plus costs slightly more than DeepSeek's busy-hour price.
Can I use my Qwen API key in Qwen Code?
Yes. Run /auth in Qwen Code, choose Standard API Key, pick your region and paste the key, or set it in ~/.qwen/settings.json.
Is Qwen made by Alibaba?
Yes. Qwen is developed by Alibaba, and the hosted API is sold through Alibaba Cloud Model Studio, with regions in Singapore, the US, Hong Kong, Japan and Beijing.
The repair messages now go out a minute after a job is closed, written by qwen3.8-flash with thinking off, for about a dime a month. Free Quota Only is switched off now, with a $5 fee alert and a monthly limit in its place. Jake read the first fifty and changed one word in the system prompt. "It writes better than I do," he said. "It writes like you," Ethan said. "You told it how."
📌 If you keep one line from this page
Create a Model Studio key in the Singapore region for the 90-day free quota, turn on Free Quota Only, call it with the OpenAI SDK at your workspace's maas.aliyuncs.com endpoint, send enable_thinking false for simple tasks, and drop to a flash model if quality holds.
qwen3.8-max $2/$6 · qwen-plus $0.40/$1.20 · qwen3.8-flash $0.15/$0.47 · qwen-flash $0.05/$0.40 per 1M tokens · International, October 22, 2026.
Revision note. Written October 22, 2026, with Alibaba Cloud Model Studio prices, free quota rules, rate limits and endpoints as of that date. "Penny wise, pound foolish," the proverb says. With AI APIs, the pennies per token are cheap, and it is the forgotten switch that costs you.