Alibaba Cloud Model Studio (Bailian) API - OpenAI Compatible

Alibaba Cloud Model Studio (Bailian) exposes Qwen-family models via OpenAI-compatible interfaces (/v1). Core endpoints include Chat Completions (/v1/chat/completions) and Embeddings (/v1/embeddings), supporting streaming, tool calls, system prompts, and multi-message context. Configure region-specific BASE_URL: Beijing (https://dashscope.aliyuncs.com/compatible-mode/v1) and Singapore (https://dashscope-intl.aliyuncs.com/compatible-mode/v1).

基础 URL
https://dashscope.aliyuncs.com/compatible-mode/v1
认证
Bearer / Authorization: Bearer
官方 SDK
Python, Java
🔑 API Key 获取
前置要求:Requires Alibaba Cloud account with Model Studio enabled and real-name verification; quotas and model permissions may require top-up or enabling in business space.
入口:https://help.aliyun.com/zh/model-studio/get-api-key
说明:Sign in to the Model Studio console, create an API key under Key Management (Beijing and Singapore keys are region-specific), and we recommend exporting it as environment variable `DASHSCOPE_API_KEY`.

支持模型

API 接口列表

POST /v1/chat/completions Docs

Chat completions (OpenAI-compatible). Supports non-streaming and streaming output, tool calls, system prompts, and conversational context. Use region-specific BASE_URL (Beijing or Singapore) with the matching regional API key.

认证Yes
频率限制600/min
计费模式按量计费(每千Token计费,输入/输出分别计费;不同模型价格不同,见计费页)。
{
  "model": "qwen-plus",
  "messages": [
    {
      "role": "system",
      "content": "You are a helpful assistant."
    },
    {
      "role": "user",
      "content": "请用中文自我介绍。"
    }
  ],
  "stream": true,
  "temperature": 0.7
}
POST /v1/embeddings Docs

Text embeddings (OpenAI-compatible). Supports multilingual embeddings and dimension options (e.g., text-embedding-v4 supports 2048/1536/1024/768/512/256/128/64).

认证Yes
频率限制600/min
计费模式按量计费(例如 text-embedding-v4:每千输入Token约 CNY 0.0005;Batch约 CNY 0.00025),详见官方页面。
{
  "model": "text-embedding-v4",
  "input": "衣服的质量杠杠的,很漂亮,不枉我等了这么久啊,喜欢,以后还来这里买",
  "encoding_format": "float",
  "dimensions": 1024
}