Aliyun Bailian API Guide: Models, Pricing, and OpenAI-Compatible Setup
Everything you need to start building with Aliyun Bailian (DashScope) — API key, OpenAI-compatible endpoints, Qwen model families, pricing tiers, rate limits, and common integration errors.
Aliyun Bailian — also known as Alibaba Cloud Model Studio — is Alibaba's managed AI model platform. It serves the entire Qwen family through DashScope, an API layer that supports both a native protocol and an OpenAI-compatible endpoint. You change three values in your existing OpenAI SDK code (API key, base URL, model name) and your application works against Qwen models without rewriting a single line of business logic.
We wrote this Aliyun Bailian API guide because DashScope documentation is spread across dozens of pages in both Chinese and English, and the relationship between "Bailian," "DashScope," and "Model Studio" confuses most developers on first contact. This is the single reference we wanted when we first added Aliyun Bailian to our routing configuration.
What Aliyun Bailian and DashScope Are
The naming can trip you up, so here is the hierarchy:
- Alibaba Cloud Model Studio (阿里云百炼) is the console — the web UI where you manage workspaces, API keys, fine-tuning jobs, and billing.
- DashScope is the API layer that serves model inference. Every API call goes through a DashScope endpoint.
- Bailian (百炼) is the Chinese-market brand name for Model Studio. International users see "Model Studio" in the Alibaba Cloud console; Chinese-mainland users see "百炼."
In practice, "Bailian" and "Model Studio" refer to the same product. DashScope is how you talk to it programmatically.
Quick Start: Your First Call in 3 Minutes
Step 1: Create an Alibaba Cloud account. Go to alibabacloud.com (international) or aliyun.com (China mainland). Activate Model Studio from the console.
Step 2: Get your API key. Navigate to the API Keys page and create a new key. DashScope lets you scope keys to specific workspaces — use this for tighter security in multi-team setups.
Step 3: Make your first call. Install the OpenAI Python SDK:
pip install --upgrade openai
Then point it at DashScope:
from openai import OpenAI
import os
client = OpenAI(
api_key=os.getenv("DASHSCOPE_API_KEY"),
base_url="https://dashscope-intl.aliyuncs.com/compatible-mode/v1", # Singapore
)
response = client.chat.completions.create(
model="qwen-plus",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "What is Alibaba Cloud Model Studio?"},
],
)
print(response.choices[0].message.content)
That is it. No DashScope-specific SDK is required unless you need native-only features like async video generation.
OpenAI-Compatible Endpoints by Region
DashScope offers regional endpoints. Pick the one closest to your deployment:
| Region | Base URL |
|---|---|
| China (Beijing) | https://dashscope.aliyuncs.com/compatible-mode/v1 |
| Singapore | https://dashscope-intl.aliyuncs.com/compatible-mode/v1 |
| US (Virginia) | https://dashscope-us.aliyuncs.com/compatible-mode/v1 |
| Hong Kong | https://cn-hongkong.dashscope.aliyuncs.com/compatible-mode/v1 |
Important: API keys are region-specific. A key generated in the Beijing region does not work against the Singapore endpoint and vice versa. If you get an InvalidApiKey error after switching regions, generate a new key in the target region's console.
The OpenAI-compatible endpoint supports chat completions, streaming, tool calling (function calling), embeddings, and the Responses API. Async operations like video generation and TTS use the native DashScope API instead.
Qwen and Third-Party Models Available Through Bailian
Bailian primarily serves the Qwen model family. As of June 2026, the key model tiers available through the OpenAI-compatible endpoint include:
Commercial models (managed by Alibaba):
- Qwen-Max series —
qwen3.7-max,qwen3-max,qwen-max: Flagship reasoning and generation. Supports both thinking and non-thinking modes. Context up to 1M tokens for the latestqwen3.7-max. - Qwen-Plus series —
qwen3.7-plus,qwen3.5-plus,qwen-plus: Strong general-purpose models at lower cost. Context up to 1M tokens. - Qwen-Flash series —
qwen3.5-flash,qwen-flash: Speed-optimized for latency-sensitive workloads. - Qwen-Turbo —
qwen-turbo: The cheapest commercial option for high-throughput, lower-complexity tasks. - Qwen-Coder series —
qwen3-coder-plus,qwen3-coder-flash: Code-specialized models. - QwQ series —
qwq-plus: Reasoning-focused model.
Open-source models (hosted on Bailian):
qwen3.5-397b-a17b,qwen3.5-120b-a10b,qwen3.5-27b,qwen3-235b-a22b,qwen3-32b,qwen3-14b,qwen3-8b, and smaller variants down toqwen3-0.6b.- Qwen 2.5 series including 1M-context variants:
qwen2.5-14b-instruct-1m,qwen2.5-7b-instruct-1m.
Model availability differs by region. The Chinese mainland endpoint offers the broadest selection; the Singapore endpoint covers most international-facing models; the US endpoint has a smaller subset. Always check the official supported model list for your target region.
Pricing, Quotas, and Rate Limits from Official Docs
Bailian uses per-token pricing with tiered rates based on input token count per request. Prices are in CNY per million tokens.
Qwen-Max (China mainland, as of June 2026):
| Model | Input Tokens | Input Price | Output Price |
|---|---|---|---|
qwen3.7-max | 0–1M | ¥12 | ¥36 |
qwen3-max | 0–32K | ¥2.5 | ¥10 |
qwen3-max | 32K–128K | ¥4 | ¥16 |
qwen3-max | 128K–256K | ¥7 | ¥28 |
Qwen-Plus (China mainland):
| Model | Input Tokens | Input Price | Output Price |
|---|---|---|---|
qwen3.7-plus | 0–256K | ¥2 | ¥8 |
qwen3.5-plus | 0–128K | ¥0.8 | ¥4.8 |
qwen-plus | 0–128K | ¥0.8 | ¥2 (non-thinking) / ¥8 (thinking) |
International (Singapore) pricing runs higher — roughly 3–4x the mainland rate for Qwen-Max models.
Free tier: New Bailian accounts get 1 million free tokens (input and output each) for select models, valid for 90 days after activation. No credit card required.
Batch API: Models that support batch inference charge 50% of real-time pricing.
Rate limits are per-account, per-model. For qwen3-max in the global deployment, the documented limit starts at 600 RPM. Limits enforce per-minute and per-second (RPM/60) bursts. A 429 response resets within one minute. The official recommendation for handling rate limits: fall back to an alternative model snapshot (e.g., qwen-plus-2025-07-14 as backup for qwen-plus-2025-07-28).
For current pricing and rate limit details, see the official pricing page and rate limits documentation.
Bailian vs SiliconFlow vs Volcengine: Routing Implications
If you are building on Chinese LLM providers, Bailian is one of three major options alongside SiliconFlow and Volcengine Ark. Here is how they compare from a routing perspective:
| Factor | Bailian (DashScope) | SiliconFlow | Volcengine Ark |
|---|---|---|---|
| Primary model family | Qwen (Alibaba) | 200+ models (multi-vendor) | Doubao (ByteDance) |
| OpenAI-compatible | Yes | Yes | Yes |
| Regional endpoints | Beijing, Singapore, US, HK, EU | China mainland (global in progress) | China mainland |
| Free tier | 1M tokens / 90 days on select models | 3 free models, no expiry | Varies by model |
| Unique strength | Official Qwen source, Coding Plan, workspace scoping | Broadest model selection, unified billing | ByteDance ecosystem integration |
For teams that primarily use Qwen models, Bailian is the canonical source — you get the latest model snapshots first, official rate limits, and direct support. For teams routing across multiple Chinese model families, SiliconFlow's breadth may be more practical. For a detailed comparison between SiliconFlow and DashScope, see our SiliconFlow vs DashScope comparison.
Common Integration Errors
InvalidApiKey after region switch. DashScope API keys are region-bound. A key from the Beijing console does not authenticate against the Singapore endpoint. Generate a new key in the correct region.
Model not found or Model does not exist. Model availability varies by region and deployment scope. Check the supported model list for your specific region. Some models (e.g., qwen-math-plus) are only available in the China mainland deployment.
429 Rate limit exceeded. Bailian enforces both RPM and TPM limits at the account level, plus per-second burst limits. Solutions: smooth your request rate with exponential backoff, fall back to an alternative model snapshot, or use batch inference for non-real-time workloads.
Allocated quota exceeded. This typically means you have hit the TPM (tokens per minute) ceiling. Shorten your prompts, reduce max_tokens, or split long documents into smaller requests.
Confusing the Coding Plan endpoint with standard Bailian. The Coding Plan uses a dedicated endpoint (https://coding.dashscope.aliyuncs.com/v1) and separate API keys. Do not mix Coding Plan keys with standard Bailian sk-* keys — they are not interchangeable.
Singapore domain migration. Alibaba is deprecating https://dashscope-intl.aliyuncs.com for the Singapore region in favor of workspace-scoped URLs (https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com). If you see deprecation warnings, update your base_url to the new format.
Multi-Provider Routing with Bailian
When we route OpenAI-compatible requests through configured providers, Bailian fits naturally as a provider backend. The OpenAI-compatible endpoint means no protocol translation is needed — the same request shape that works against OpenAI or SiliconFlow works against DashScope.
A practical routing pattern: use Bailian as the primary for Qwen models (since it is the official source with the latest snapshots), and configure SiliconFlow or another provider as a fallback. If Bailian returns a 429, the router retries against the fallback provider transparently. For more on designing fallback chains across providers, see our LLM API fallback routing guide.
# Example: OpenAI SDK with Bailian as primary
from openai import OpenAI
# Primary: Bailian
bailian_client = OpenAI(
api_key="sk-bailian-xxx",
base_url="https://dashscope.aliyuncs.com/compatible-mode/v1",
)
# Fallback: SiliconFlow
siliconflow_client = OpenAI(
api_key="sk-siliconflow-xxx",
base_url="https://api.siliconflow.cn/v1",
)
try:
response = bailian_client.chat.completions.create(
model="qwen3-max",
messages=[{"role": "user", "content": "Explain quantum computing"}],
)
except Exception:
# Fallback to SiliconFlow
response = siliconflow_client.chat.completions.create(
model="Qwen/Qwen3-235B-A22B",
messages=[{"role": "user", "content": "Explain quantum computing"}],
)
FAQ
Is Bailian the same as DashScope? Bailian (百炼) is the product/console brand; DashScope is the underlying API service. In practice, they refer to the same platform. Your API calls go through DashScope endpoints; you manage everything through the Bailian console.
Can I use the OpenAI SDK directly with Bailian?
Yes. Set base_url to the appropriate DashScope endpoint and use your Bailian API key. No additional SDK is needed for chat completions, streaming, tool calling, or embeddings.
What models are free on Bailian?
New accounts get 1 million free tokens on select models (like qwen3.7-max and qwen3.7-plus), valid for 90 days. Some open-source models hosted on Bailian have separate free quotas. Check the pricing page for current free-tier details.
How does Bailian pricing compare to OpenAI?
Qwen models on Bailian are significantly cheaper than equivalent-tier OpenAI models. For example, qwen3-max starts at ¥2.5/M input tokens (~$0.35 USD) for the first 32K tokens on the China mainland endpoint — roughly 10x cheaper than GPT-4o. International endpoint pricing is higher but still competitive.
Can I use Bailian from outside China?
Yes. Use the Singapore (dashscope-intl.aliyuncs.com), US Virginia (dashscope-us.aliyuncs.com), or Hong Kong endpoint. You need an Alibaba Cloud international account and a region-appropriate API key.
Does Bailian support function calling / tool use? Yes. The OpenAI-compatible endpoint supports tool calling with the same request format as the OpenAI API. Structured output and the Responses API are also supported on newer model versions.
Sources: Alibaba Cloud Model Studio — OpenAI Compatibility, Bailian Model Pricing, Rate Limits, DashScope API Reference. Retrieved June 2026.