Skip to content
English

Switch theme

// Models · API key guide

Qwen API key: how to get one

Qwen models are sold through Alibaba Cloud Model Studio (Bailian); the key you create there is the DashScope key (DASHSCOPE_API_KEY).

5 stepsofficial docs onlychecked 2026-10-26

01How to get a Qwen (Tongyi Qianwen) API key

  1. Log in to Alibaba Cloud and open the Model Studio (Bailian) console; activate the service if prompted (real-name verification may be requested – follow the console).
  2. Choose the region first (e.g. China (Beijing)). Keys are tied to a region and do not work across regions.
  3. Open “API Key” → “Create API Key”, pick the owning account and workspace, and set permissions (all, or limited by model / IP).
  4. Copy the key into the environment variable DASHSCOPE_API_KEY.
  5. Call qwen3.8-max (or another Qwen model) through the OpenAI-compatible endpoint below.

Official key page: https://bailian.console.aliyun.com/?tab=model#/api-key – console labels may change; follow what the official page shows.

02Real-name, phone and credit card requirements

Real-name / ID verificationNot needed to receive or use the free quota; needed to continue with pay-as-you-go after it runs out. Unverified accounts have “stop when free quota runs out” forced on.
Phone numberAn Alibaba Cloud account is required; account sign-up rules are on Alibaba Cloud’s site.
Credit card / paymentNot needed for the free quota. Paid usage is billed to your Alibaba Cloud account.

03Base URL and a minimal call

Base URL:https://dashscope.aliyuncs.com/compatible-mode/v1
China (Beijing) region. Newer docs also show a workspace-specific endpoint https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/compatible-mode/v1. Other regions use their own endpoints – use the one shown in your console.
Environment variable:DASHSCOPE_API_KEY · Example model:qwen3.8-max
qwen3.8-max is the model used in the official first-call example.

curl

curl https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
  -d '{
    "model": "qwen3.8-max",
    "messages": [{"role": "user", "content": "你好"}]
  }'

Python

# pip install openai
import os
from openai import OpenAI

client = OpenAI(api_key=os.environ["DASHSCOPE_API_KEY"], base_url="https://dashscope.aliyuncs.com/compatible-mode/v1")
resp = client.chat.completions.create(
    model="qwen3.8-max",
    messages=[{"role": "user", "content": "你好"}],
)
print(resp.choices[0].message.content)

New-user free quota: granted automatically on first activation, usually about 1M tokens per model, valid 90 days, China (Beijing) region only, real-time inference only, shared by the main account and its RAM users.

Our free-API tracker:On first activation each model gets its own new-user quota, valid 90 days; Beijing region only.
checked 2026-11-02 · details →

05Qwen (Tongyi Qianwen) API prices

All model prices →
ModelInput / 1M tokensOutput / 1M tokensSource
Qwen3.7-Flashqwen3.7-flash ¥0.2¥0.8 official · 2026-10-10
Qwen-Turboqwen-turbo ¥0.3¥0.6 official · 2026-10-10
Qwen-Flashqwen-flash ¥0.15¥1.5 official · 2026-10-10
Qwen3-VL-Flashqwen3-vl-flash ¥0.15¥1.5 official · 2026-10-10
Qwen3.5-Flashqwen3.5-flash ¥0.2¥2 official · 2026-10-10
Qwen-Longqwen-long ¥0.5¥2 official · 2026-10-10
Qwen-Plusqwen-plus ¥0.8¥2 official · 2026-10-10
Qwen3.5-35B-A3Bqwen3.5-35b-a3b ¥0.4¥3.2 official · 2026-10-10

Standard (non-batch) list prices from our price database; cheapest first, max 8 rows. Prices change – the official page wins.

06Keep your API key safe

07FAQ

FAQ

Where do I get a Qwen API key?

In the Alibaba Cloud Model Studio (Bailian) console → API Key → Create API Key. There is no separate “Qwen” key – the Bailian / DashScope key is it.

Is the Qwen API free?

New users get a free quota (about 1M tokens per model, 90 days, Beijing region). After that it is pay-as-you-go.

Can I use the OpenAI SDK with Qwen?

Yes – set base_url to the compatible-mode endpoint (https://dashscope.aliyuncs.com/compatible-mode/v1 for Beijing) and use your DashScope key.

08Official sources

All facts checked against these pages on 2026-10-26. If anything differs, the official page wins.

09Related

Other API key guides

Data updated: Model API prices · HF model metadata(UTC+8)