og.cc.cd / guides / aliyun-bailian-api-key

How to Get an Alibaba Cloud Model Studio (Bailian) API Key — China & Singapore

By og.cc.cd · Published · Updated · 4 min read

TL;DR: Alibaba Cloud Model Studio (Bailian) keys, endpoints and models are region-specific, so choose the China (Beijing) or International (Singapore) site first, then create the key in that region.

Updated · All sources ↓

Alibaba Cloud Model Studio (阿里云百炼) serves Qwen and other models through an OpenAI-compatible API. Keys, domains and models are separate per region, so decide first whether you need the China (Beijing) site or the international (Singapore) site.

Count Qwen tokens and cost →All guides

Pick a region first

Model Studio has a China site (华北2 Beijing) and an international site (Singapore, ap-southeast-1). In the console you choose the region in the top-right corner; API keys, domains and models of different regions cannot be mixed (获取 API Key).

China site (Beijing)International site (Singapore)
API key pagehttps://bailian.console.aliyun.com/cn-beijing/model/settings/api-keyhttps://modelstudio.console.alibabacloud.com/ap-southeast-1/settings/api-key
OpenAI-compatible base URLhttps://dashscope.aliyuncs.com/compatible-mode/v1https://dashscope-intl.aliyuncs.com/compatible-mode/v1
Recommended workspace domain{WorkspaceId}.cn-beijing.maas.aliyuncs.com{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com
Account requirementFree quota needs no real-name verification; pay-as-you-go after it requires real-name verification + top-upSince 15 Sep 2026 you must complete your account information before activating Model Studio
Free quotaBeijing-region models; usually 1M tokens per model, valid 90 daysSingapore-region, International-scope models; usually 1M tokens per model, 90 days
Key limits50 keys per account per region10 workspaces per account, 20 keys per workspace

Create the key (China site)

  1. Sign in to Alibaba Cloud and open Model Studio — via our partner link or directly — then go to the API Key page (https://bailian.console.aliyun.com/cn-beijing/model/settings/api-key) and check the region in the top-right corner.
  2. Click 创建 API Key (Create API Key).
  3. Set 归属账号 (owner — main account by default, or a RAM user), 归属业务空间 (workspace — the default workspace by default) and 权限 (permissions: “全部”/all is suggested, or “自定义”/custom with up to 20 whitelisted IPs and up to 30 models).
  4. Click 确定 (OK) and copy the key. Only a super administrator or a workspace administrator can do this.

On the international site the dialog is in English: Create API Key → Workspace (default suggested), optional Description (up to 200 characters), Permissions (All / Custom) → OK. A pop-up shows the full key and the API Host; copy or download it right away (Obtain an API key).

Key format: the English documentation (which covers China (Beijing), Singapore and other regions, updated 2026-10-11) says keys created after the upgrade start with sk-ws and the plaintext is shown only once; older sk- keys (about 32 characters) keep working; Token Plan / Coding Plan keys start with sk-sp-. The Chinese page still describes copying the key from an icon next to it, so the two pages differ — go by what your console shows, and copy the key as soon as it is created.

Free quota, real-name verification and billing

  • China site: the free quota is issued automatically when you first activate the service, only for Beijing-region models — usually 1M tokens per model, valid for 90 days, shared between the main account and its RAM users. The same real-name identity cannot claim it again by registering a new account.
  • Real-name: claiming and using the free quota does not require real-name verification. Once it is used up, unverified users must complete real-name verification and top up before pay-as-you-go works; for unverified users “stop when the free quota runs out” (免费额度用完即停) is forced on (新人免费额度).
  • Payment (China site): Alipay, UnionPay online payment, online banking and others — check the top-up page for the current list.
  • International site: the free quota covers Singapore-region, International-scope models (usually 1M tokens per model, 90 days). “Free Quota Only” is off by default, so usage rolls into pay-as-you-go automatically when the quota runs out (Free quota). Payment methods are not stated on the pages we checked.

Before you top up, paste a typical prompt into the token counter and estimate a month of traffic with the LLM cost calculator.

Base URL and authentication

Both sites use Bearer authentication with the OpenAI-compatible path /compatible-mode/v1. Alibaba recommends moving to your workspace’s dedicated domain, because the dashscope domains get no new features after 30 Sep 2026. Singapore also offers a trial domain trial.ap-southeast-1.maas.aliyuncs.com (1,000 RPM, no SLA) (Regions).

Hello world

export DASHSCOPE_API_KEY="paste-your-key-here"   # never commit this

# China (Beijing) region. Singapore: https://dashscope-intl.aliyuncs.com/compatible-mode/v1
curl https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions \
  -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen-plus",
    "messages": [{"role": "user", "content": "Say hello in one sentence."}]
  }'
# Recommended: your workspace domain https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/compatible-mode/v1

The documentation uses qwen-plus as the example; the same key can also call other models listed in the console, such as qwen-max or deepseek-v4-pro.

Common gotchas

  • Wrong region. A Beijing key will not work against the Singapore domain (and vice versa), and the free quota is region-specific.
  • Quota ran out and calls stopped. On the China site, unverified accounts stop automatically; complete real-name verification and top up.
  • Lost the key. New keys are shown in full only once — create another (you have up to 50 per account and region on the China site).
  • Key in a front-end app. Do not use long-lived keys in browsers or mobile apps; Model Studio offers temporary keys (valid up to 1,800 seconds) for that. Long-lived keys have no expiry date. Put the key in an environment variable, keep it out of Git and out of any code that runs in a browser or mobile app, and replace it if it is ever exposed. The API keys overview has the full checklist.

FAQ

Do I need real-name verification to try Qwen?

Not on the China site’s free quota. You need it (plus a top-up) once the free quota is used up and you want pay-as-you-go.

Which environment variable does the SDK use?

DASHSCOPE_API_KEY.

Does the key expire?

Regular keys have no expiry time; temporary keys last at most 1,800 seconds.

Sources

Vendor features and prices were checked against these official pages on 2026-10-20. Products change; if something here no longer matches, the official page is right.

Related guides