How to get a Qwen API key (QwenCloud and Alibaba Cloud)

Updated · 7 min read

Qwen's API is run by Alibaba Cloud. Outside mainland China you create a key on QwenCloud (home.qwencloud.com), Alibaba's developer platform for Qwen, or in the Alibaba Cloud Model Studio console. Both bill in US dollars, and every key belongs to one region. New users in the Singapore region get a free quota, typically 1 million tokens per model for 90 days. After that, the flagship qwen4-max costs $1.50 per million input tokens and $4.50 per million output tokens.

Step by step

QwenCloud is the shorter path. You sign up with GitHub or email, and Qwen Code calls it the official recommended setup.

  1. Sign up at home.qwencloud.com with GitHub or an email code. Choose your country carefully, because it cannot be changed later. An existing Alibaba Cloud International email signs straight in.
  2. Add payment details on the Free Tier page. This unlocks the free quota.
  3. Keep the region on Singapore, the console default. Only Singapore has the free quota.
  4. Create a key on the API Keys page, add a description and click Generate Key. Copy it right away, because the full key is shown only once. Pay-as-you-go keys start with sk-ws- (older ones with sk-).
  5. Add it to your app as a custom OpenAI-compatible provider with base URL https://ap-southeast-1.maas.qwencloudapi.com/compatible-mode/v1 and a model such as qwen3.7-plus or qwen4-max.

In Alibaba Cloud Model Studio, open the console, pick the region in the upper-right corner, go to API Key and click Create API Key. Model Studio asks you to complete your account information before it activates. Model Studio supports RAM users (Alibaba Cloud sub-accounts) and per-key IP and model limits, while QwenCloud accepts only main accounts. Its base URL contains your workspace ID: https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1. The older https://dashscope-intl.aliyuncs.com/compatible-mode/v1 still works for existing apps.

Regions: a key only works in its own region

Region QwenCloud base URL (OpenAI format) Where inference runs
Singapore https://ap-southeast-1.maas.qwencloudapi.com/compatible-mode/v1 Outside mainland China; free quota and Token Plan only here
US (Virginia) https://us-east-1.maas.qwencloudapi.com/compatible-mode/v1 Global, or US only
Germany (Frankfurt) https://eu-central-1.maas.qwencloudapi.com/compatible-mode/v1 Global, or EU only
Japan (Tokyo) https://ap-northeast-1.maas.qwencloudapi.com/compatible-mode/v1 Global, or Japan only
China (Hong Kong) https://cn-hongkong.maas.qwencloudapi.com/compatible-mode/v1 Global, or Hong Kong only
China North 2 (Beijing) https://cn-beijing.maas.qwencloudapi.com/compatible-mode/v1 Mainland China

For Anthropic-compatible tools, replace /compatible-mode/v1 with /apps/anthropic. In Frankfurt, Hong Kong, Tokyo and Virginia, you choose the scope when you create a workspace, and it cannot be changed. The Global scope can run inference anywhere, including mainland China, so pick the local scope if your data must stay in one place. A key sent to another region's URL fails with 401 invalid_api_key.

The free quota

  • It applies only to real-time calls in Singapore, with a Singapore key, to the Singapore endpoint.
  • Each model has its own quota, typically 1,000,000 tokens, with input and output counted together. Dated snapshots (such as qwen3.7-plus-2026-05-26) have separate quotas, and nothing switches models for you when one runs out.
  • It lasts 90 days from activation. For models released later, the 90 days start on the release date. Unused tokens expire, and a second account gets no new quota.
  • It does not cover batch calls, built-in tools such as web search, or fine-tuning.
  • Alibaba removes the free quota from some models for new users. On 2026-11-15 it was removed from qwen3.8-max-0902, kimi-k3, deepseek-v4-pro and deepseek-v4.1-flash-1017. The Free Tier page shows what your account has left.

When a model's quota runs out, calls are billed automatically. To avoid that, turn on Free quota only on the Free Tier page: the API then returns AllocationQuota.FreeTierOnly instead of charging you. At about 2,500 tokens per chat turn, 1 million tokens lasts roughly 400 turns per model.

Qwen API pricing

These are the prices per million tokens in the Singapore region on 2026-11-18:

Model Input Output Notes
qwen4-max $1.50 $4.50 Newest flagship, 1M context, cache hits $0.075, free quota
qwen3.8-max $2.00 $6.00 Previous flagship, free quota
qwen3.7-plus $0.40 $1.60 Up to 256K input; $1.20 / $4.80 above that; free quota
qwen3.8-flash $0.15 $0.47 Fast and cheap, 1M context
qwen3.7-flash $0.03 $0.13 Up to 32K input; $0.10 / $0.40 to 256K; $0.20 / $0.80 to 1M
qwen3-coder-flash $0.30 $1.50 Up to 32K input, rising to $1.60 / $9.60 at 256K-1M; no free quota

Several models use tiered pricing: the input size of a request sets the rate for all of its tokens. Thinking tokens are billed as output. Alibaba listed qwen3.7-plus at 20% off for a limited time. In Beijing and the Global scope, qwen4-max is slightly cheaper ($1.413 / $4.24).

Caching cuts input cost. On most models, automatic (implicit) cache hits are typically billed at 20% of the input price, and explicit cache hits at 10%. qwen4-max has its own cache prices: $1.875 per million tokens to write a 5-minute cache, $3 for a 1-hour cache and $0.075 per hit. The Batch API halves prices on models that support it (qwen4-max does not).

A chat turn of 2,000 tokens in and 500 out costs about $0.0016 on qwen3.7-plus and $0.005 on qwen4-max.

Coding plans and Qwen Code

Heavy users of coding agents can pay a monthly fee instead of per token. These plans use a separate key starting with sk-sp- and their own endpoint; the free quota does not apply to them.

  • QwenCloud Token Plan Individual (Singapore only): Lite $6/month (20,000 Credits), Essential $10 (45,000), Standard $18 (80,000) and Pro $43 (200,000). Lite and Essential cost $3 and $5 for new users until November 30, 2026. Endpoint: https://token-plan.maas.qwencloudapi.com/compatible-mode/v1. It covers qwen4-max, qwen3.8-max, qwen3.7-plus and some GLM and DeepSeek models.
  • Alibaba Cloud Model Studio Coding Plan Pro: $50/month for up to 6,000 requests per 5 hours, 45,000 per week and 90,000 per month. Endpoint: https://coding-intl.dashscope.aliyuncs.com/v1. Sign-up slots are limited, the plan is non-refundable, and its key may only be used in interactive coding tools, not in scripts or app backends.

Qwen Code is Alibaba's open-source terminal coding agent. Its /auth menu signs in with a Qwen account that has a Plus or Pro subscription from chat.qwen.ai, or takes a QwenCloud or Model Studio key (pay-as-you-go or plan). It also connects to other providers and to local models.

Use the key in apps

  • Apps with a Qwen, Alibaba or DashScope option: paste the key and check the region or endpoint setting. It must match the region where you created the key; dashscope-intl.aliyuncs.com is Model Studio's Singapore endpoint.
  • Any OpenAI-compatible app: use the base URL from the region table and a model ID from the price list.
  • Claude Code and other Anthropic-compatible tools: https://ap-southeast-1.maas.qwencloudapi.com/apps/anthropic with your Singapore key. See using other keys in Claude Code.
  • OpenRouter: qwen/qwen4-max and many other Qwen models are on OpenRouter, so one key covers Qwen and other providers. On 2026-11-18 none of them was free there.

Run Qwen on your own computer

Many Qwen models have open weights, so you can run them locally with no key and no bill. In Ollama, ollama run qwen3.8 downloads the 27B model (18 GB, 256K context, text and images), which needs a machine with about 32 GB of memory. Smaller tags such as qwen3.5:4b and qwen3.5:9b fit ordinary laptops. LM Studio's catalog has the same Qwen3.8 27B model. Local models are far smaller than the hosted qwen3.8-max (2.4 trillion parameters), but your prompts never leave your machine. See local LLM apps for setup.

Limits and gotchas

  • Rate limits are set per model for your whole account. Each model's page in the Model Marketplace lists its requests and tokens per minute, and a burst within a single second can be throttled even below those limits.
  • If you have a plan, a pay-as-you-go key in your coding tool is billed per token on top of the plan. Use the sk-sp- key with the plan URL, or delete the pay-as-you-go key.
  • Model IDs change often. If an app's default model fails, pick a current ID from the price list.

Keep the key safe

  • Use one key per app, and delete keys you no longer use. Deleted keys cannot be restored.
  • Never put the key in a website's front-end code or a public repository.
  • In Model Studio, set Custom permissions to limit a key to certain models and IP addresses. In QwenCloud, give each project its own workspace with its own model permissions and rate limits.

Apps that work with your Qwen API key

  • Conduit

    Free · Windows, macOS, Linux · Open source

    Visit

    Open-source desktop AI app for agents, research, writing and slides that runs on your own keys from 23 providers or local models.

    Works with:AnthropicOpenAIGoogle GeminixAI+12 more

  • SoloMD

    Free · macOS, Windows, Linux · Open source

    Visit

    Free, open-source Markdown editor for desktop and mobile with built-in AI tools that run on your own key from 14 providers.

    Works with:OpenAIAnthropicGoogle GeminixAI+7 more

  • Shotluma

    Free · Web · Open source

    Visit

    Free, open-source App Store screenshot editor whose AI generation runs in the browser on your own Gemini, Qwen, OpenAI, Anthropic or xAI key.

    Works with:Google GeminiQwenOpenAIAnthropic+1 more

  • NewMax

    One-time lifetime license from $399 · macOS, Windows

    Visit

    Desktop AI agent that runs workflows on your local files with your own API key or a local model; nothing routes through NewMax.

    Works with:OpenAIAnthropicGoogle GeminiMistral+6 more

  • Intrascope

    From $59/month · Web, Android

    Visit

    Secure AI workspace for teams that centralizes access to major AI models, shared context, usage tracking, and company-level BYOK controls.

    Works with:OpenAIAnthropicGoogle GeminiDeepSeek+3 more

Other options

For another Chinese model family, see the Kimi API key guide. DeepSeek halves its prices outside peak hours, and free AI API keys compares every free tier.

Questions

Is the Qwen API free?

Partly. New users get a free quota in the Singapore region, typically 1 million tokens per model for 90 days, once they add payment details. After that you pay per token, unless you switch on Free quota only, which stops calls instead of billing.

How much does the Qwen API cost?

In the Singapore region on 2026-11-18, qwen4-max cost $1.50 per million input tokens and $4.50 per million output tokens, qwen3.7-plus $0.40 / $1.60 (for requests up to 256K tokens), and qwen3.8-flash $0.15 / $0.47.

Where do I create a Qwen API key?

On the API Keys page of QwenCloud (home.qwencloud.com/api-keys) or in the Alibaba Cloud Model Studio console. Pick the region first, because each key works only with its own region's endpoint.

Why does my Qwen key return 401 invalid_api_key?

Usually the key and the base URL belong to different regions, for example a Beijing key sent to the Singapore endpoint. Create the key in the region whose URL your app calls.

Is DashScope the same as the Qwen API?

Yes. DashScope is the name of Alibaba's model API and of its older domains. dashscope-intl.aliyuncs.com still works for existing apps, but Alibaba says it gets no new features after September 30, 2026 and points new setups to the newer endpoints.

Can I use a Qwen coding plan key in any app?

No. Plan keys start with sk-sp- and work only with the plan's own endpoint. Alibaba's Coding Plan also forbids using its key in scripts or app backends; it is meant for interactive coding tools.

Sources

Checked against the providers' own documentation on 2026-11-18. Prices and limits change; the links below have the current figures.

Related guides