# <img src="https://models.dev/logos/alibaba-cn.svg" alt="Alibaba (China) logo" className="inline w-8 h-8 mr-2 align-middle dark:invert dark:brightness-0 dark:contrast-200" />Alibaba (China)
[EN] Source: https://mastra.ai/models/providers/alibaba-cn

Access 61 Alibaba (China) models through Mastra's model router. Authentication is handled automatically using the `DASHSCOPE_API_KEY` environment variable.

Learn more in the [Alibaba (China) documentation](https://www.alibabacloud.com/help/en/model-studio/models).

```bash
DASHSCOPE_API_KEY=your-api-key
```

```typescript
import { Agent } from "@mastra/core";

const agent = new Agent({
  name: "my-agent",
  instructions: "You are a helpful assistant",
  model: "alibaba-cn/deepseek-r1"
});

// Generate a response
const response = await agent.generate("Hello!");

// Stream a response
const stream = await agent.stream("Tell me a story");
for await (const chunk of stream) {
  console.log(chunk);
}
```

:::info

Mastra uses the OpenAI-compatible `/chat/completions` endpoint. Some provider-specific features may not be available. Check the [Alibaba (China) documentation](https://www.alibabacloud.com/help/en/model-studio/models) for details.

:::

## Models

<ProviderModelsTable
  models={[
  {
    "model": "alibaba-cn/deepseek-r1",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": true,
    "contextWindow": 131072,
    "maxOutput": 16384,
    "inputCost": 0.574,
    "outputCost": 2.294
  },
  {
    "model": "alibaba-cn/deepseek-r1-0528",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": true,
    "contextWindow": 131072,
    "maxOutput": 16384,
    "inputCost": 0.574,
    "outputCost": 2.294
  },
  {
    "model": "alibaba-cn/deepseek-r1-distill-llama-70b",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": true,
    "contextWindow": 32768,
    "maxOutput": 16384,
    "inputCost": 0.287,
    "outputCost": 0.861
  },
  {
    "model": "alibaba-cn/deepseek-r1-distill-llama-8b",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": true,
    "contextWindow": 32768,
    "maxOutput": 16384,
    "inputCost": null,
    "outputCost": null
  },
  {
    "model": "alibaba-cn/deepseek-r1-distill-qwen-1-5b",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": true,
    "contextWindow": 32768,
    "maxOutput": 16384,
    "inputCost": null,
    "outputCost": null
  },
  {
    "model": "alibaba-cn/deepseek-r1-distill-qwen-14b",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": true,
    "contextWindow": 32768,
    "maxOutput": 16384,
    "inputCost": 0.144,
    "outputCost": 0.431
  },
  {
    "model": "alibaba-cn/deepseek-r1-distill-qwen-32b",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": true,
    "contextWindow": 32768,
    "maxOutput": 16384,
    "inputCost": 0.287,
    "outputCost": 0.861
  },
  {
    "model": "alibaba-cn/deepseek-r1-distill-qwen-7b",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": true,
    "contextWindow": 32768,
    "maxOutput": 16384,
    "inputCost": 0.072,
    "outputCost": 0.144
  },
  {
    "model": "alibaba-cn/deepseek-v3",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": false,
    "contextWindow": 65536,
    "maxOutput": 8192,
    "inputCost": 0.287,
    "outputCost": 1.147
  },
  {
    "model": "alibaba-cn/deepseek-v3-1",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": false,
    "contextWindow": 131072,
    "maxOutput": 65536,
    "inputCost": 0.574,
    "outputCost": 1.721
  },
  {
    "model": "alibaba-cn/deepseek-v3-2-exp",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": false,
    "contextWindow": 131072,
    "maxOutput": 65536,
    "inputCost": 0.287,
    "outputCost": 0.431
  },
  {
    "model": "alibaba-cn/moonshot-kimi-k2-instruct",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": false,
    "contextWindow": 131072,
    "maxOutput": 131072,
    "inputCost": 0.574,
    "outputCost": 2.294
  },
  {
    "model": "alibaba-cn/qvq-max",
    "imageInput": true,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": true,
    "contextWindow": 131072,
    "maxOutput": 8192,
    "inputCost": 1.147,
    "outputCost": 4.588
  },
  {
    "model": "alibaba-cn/qwen-deep-research",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": false,
    "contextWindow": 1000000,
    "maxOutput": 32768,
    "inputCost": 7.742,
    "outputCost": 23.367
  },
  {
    "model": "alibaba-cn/qwen-doc-turbo",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": false,
    "contextWindow": 131072,
    "maxOutput": 8192,
    "inputCost": 0.087,
    "outputCost": 0.144
  },
  {
    "model": "alibaba-cn/qwen-flash",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": true,
    "contextWindow": 1000000,
    "maxOutput": 32768,
    "inputCost": 0.022,
    "outputCost": 0.216
  },
  {
    "model": "alibaba-cn/qwen-long",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": false,
    "contextWindow": 10000000,
    "maxOutput": 8192,
    "inputCost": 0.072,
    "outputCost": 0.287
  },
  {
    "model": "alibaba-cn/qwen-math-plus",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": false,
    "contextWindow": 4096,
    "maxOutput": 3072,
    "inputCost": 0.574,
    "outputCost": 1.721
  },
  {
    "model": "alibaba-cn/qwen-math-turbo",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": false,
    "contextWindow": 4096,
    "maxOutput": 3072,
    "inputCost": 0.287,
    "outputCost": 0.861
  },
  {
    "model": "alibaba-cn/qwen-max",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": false,
    "contextWindow": 131072,
    "maxOutput": 8192,
    "inputCost": 0.345,
    "outputCost": 1.377
  },
  {
    "model": "alibaba-cn/qwen-mt-plus",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": false,
    "reasoning": false,
    "contextWindow": 16384,
    "maxOutput": 8192,
    "inputCost": 0.259,
    "outputCost": 0.775
  },
  {
    "model": "alibaba-cn/qwen-mt-turbo",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": false,
    "reasoning": false,
    "contextWindow": 16384,
    "maxOutput": 8192,
    "inputCost": 0.101,
    "outputCost": 0.28
  },
  {
    "model": "alibaba-cn/qwen-omni-turbo",
    "imageInput": true,
    "audioInput": true,
    "videoInput": true,
    "toolUsage": true,
    "reasoning": false,
    "contextWindow": 32768,
    "maxOutput": 2048,
    "inputCost": 0.058,
    "outputCost": 0.23
  },
  {
    "model": "alibaba-cn/qwen-omni-turbo-realtime",
    "imageInput": true,
    "audioInput": true,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": false,
    "contextWindow": 32768,
    "maxOutput": 2048,
    "inputCost": 0.23,
    "outputCost": 0.918
  },
  {
    "model": "alibaba-cn/qwen-plus",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": true,
    "contextWindow": 1000000,
    "maxOutput": 32768,
    "inputCost": 0.115,
    "outputCost": 0.287
  },
  {
    "model": "alibaba-cn/qwen-plus-character",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": false,
    "contextWindow": 32768,
    "maxOutput": 4096,
    "inputCost": 0.115,
    "outputCost": 0.287
  },
  {
    "model": "alibaba-cn/qwen-turbo",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": true,
    "contextWindow": 1000000,
    "maxOutput": 16384,
    "inputCost": 0.044,
    "outputCost": 0.087
  },
  {
    "model": "alibaba-cn/qwen-vl-max",
    "imageInput": true,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": false,
    "contextWindow": 131072,
    "maxOutput": 8192,
    "inputCost": 0.23,
    "outputCost": 0.574
  },
  {
    "model": "alibaba-cn/qwen-vl-ocr",
    "imageInput": true,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": false,
    "reasoning": false,
    "contextWindow": 34096,
    "maxOutput": 4096,
    "inputCost": 0.717,
    "outputCost": 0.717
  },
  {
    "model": "alibaba-cn/qwen-vl-plus",
    "imageInput": true,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": false,
    "contextWindow": 131072,
    "maxOutput": 8192,
    "inputCost": 0.115,
    "outputCost": 0.287
  },
  {
    "model": "alibaba-cn/qwen2-5-14b-instruct",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": false,
    "contextWindow": 131072,
    "maxOutput": 8192,
    "inputCost": 0.144,
    "outputCost": 0.431
  },
  {
    "model": "alibaba-cn/qwen2-5-32b-instruct",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": false,
    "contextWindow": 131072,
    "maxOutput": 8192,
    "inputCost": 0.287,
    "outputCost": 0.861
  },
  {
    "model": "alibaba-cn/qwen2-5-72b-instruct",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": false,
    "contextWindow": 131072,
    "maxOutput": 8192,
    "inputCost": 0.574,
    "outputCost": 1.721
  },
  {
    "model": "alibaba-cn/qwen2-5-7b-instruct",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": false,
    "contextWindow": 131072,
    "maxOutput": 8192,
    "inputCost": 0.072,
    "outputCost": 0.144
  },
  {
    "model": "alibaba-cn/qwen2-5-coder-32b-instruct",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": false,
    "contextWindow": 131072,
    "maxOutput": 8192,
    "inputCost": 0.287,
    "outputCost": 0.861
  },
  {
    "model": "alibaba-cn/qwen2-5-coder-7b-instruct",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": false,
    "contextWindow": 131072,
    "maxOutput": 8192,
    "inputCost": 0.144,
    "outputCost": 0.287
  },
  {
    "model": "alibaba-cn/qwen2-5-math-72b-instruct",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": false,
    "contextWindow": 4096,
    "maxOutput": 3072,
    "inputCost": 0.574,
    "outputCost": 1.721
  },
  {
    "model": "alibaba-cn/qwen2-5-math-7b-instruct",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": false,
    "contextWindow": 4096,
    "maxOutput": 3072,
    "inputCost": 0.144,
    "outputCost": 0.287
  },
  {
    "model": "alibaba-cn/qwen2-5-omni-7b",
    "imageInput": true,
    "audioInput": true,
    "videoInput": true,
    "toolUsage": true,
    "reasoning": false,
    "contextWindow": 32768,
    "maxOutput": 2048,
    "inputCost": 0.087,
    "outputCost": 0.345
  },
  {
    "model": "alibaba-cn/qwen2-5-vl-72b-instruct",
    "imageInput": true,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": false,
    "contextWindow": 131072,
    "maxOutput": 8192,
    "inputCost": 2.294,
    "outputCost": 6.881
  },
  {
    "model": "alibaba-cn/qwen2-5-vl-7b-instruct",
    "imageInput": true,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": false,
    "contextWindow": 131072,
    "maxOutput": 8192,
    "inputCost": 0.287,
    "outputCost": 0.717
  },
  {
    "model": "alibaba-cn/qwen3-14b",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": true,
    "contextWindow": 131072,
    "maxOutput": 8192,
    "inputCost": 0.144,
    "outputCost": 0.574
  },
  {
    "model": "alibaba-cn/qwen3-235b-a22b",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": true,
    "contextWindow": 131072,
    "maxOutput": 16384,
    "inputCost": 0.287,
    "outputCost": 1.147
  },
  {
    "model": "alibaba-cn/qwen3-32b",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": true,
    "contextWindow": 131072,
    "maxOutput": 16384,
    "inputCost": 0.287,
    "outputCost": 1.147
  },
  {
    "model": "alibaba-cn/qwen3-8b",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": true,
    "contextWindow": 131072,
    "maxOutput": 8192,
    "inputCost": 0.072,
    "outputCost": 0.287
  },
  {
    "model": "alibaba-cn/qwen3-asr-flash",
    "imageInput": false,
    "audioInput": true,
    "videoInput": false,
    "toolUsage": false,
    "reasoning": false,
    "contextWindow": 53248,
    "maxOutput": 4096,
    "inputCost": 0.032,
    "outputCost": 0.032
  },
  {
    "model": "alibaba-cn/qwen3-coder-30b-a3b-instruct",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": false,
    "contextWindow": 262144,
    "maxOutput": 65536,
    "inputCost": 0.216,
    "outputCost": 0.861
  },
  {
    "model": "alibaba-cn/qwen3-coder-480b-a35b-instruct",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": false,
    "contextWindow": 262144,
    "maxOutput": 65536,
    "inputCost": 0.861,
    "outputCost": 3.441
  },
  {
    "model": "alibaba-cn/qwen3-coder-flash",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": false,
    "contextWindow": 1000000,
    "maxOutput": 65536,
    "inputCost": 0.144,
    "outputCost": 0.574
  },
  {
    "model": "alibaba-cn/qwen3-coder-plus",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": false,
    "contextWindow": 1048576,
    "maxOutput": 65536,
    "inputCost": 1,
    "outputCost": 5
  },
  {
    "model": "alibaba-cn/qwen3-max",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": false,
    "contextWindow": 262144,
    "maxOutput": 65536,
    "inputCost": 0.861,
    "outputCost": 3.441
  },
  {
    "model": "alibaba-cn/qwen3-next-80b-a3b-instruct",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": false,
    "contextWindow": 131072,
    "maxOutput": 32768,
    "inputCost": 0.144,
    "outputCost": 0.574
  },
  {
    "model": "alibaba-cn/qwen3-next-80b-a3b-thinking",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": true,
    "contextWindow": 131072,
    "maxOutput": 32768,
    "inputCost": 0.144,
    "outputCost": 1.434
  },
  {
    "model": "alibaba-cn/qwen3-omni-flash",
    "imageInput": true,
    "audioInput": true,
    "videoInput": true,
    "toolUsage": true,
    "reasoning": true,
    "contextWindow": 65536,
    "maxOutput": 16384,
    "inputCost": 0.058,
    "outputCost": 0.23
  },
  {
    "model": "alibaba-cn/qwen3-omni-flash-realtime",
    "imageInput": true,
    "audioInput": true,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": false,
    "contextWindow": 65536,
    "maxOutput": 16384,
    "inputCost": 0.23,
    "outputCost": 0.918
  },
  {
    "model": "alibaba-cn/qwen3-vl-235b-a22b",
    "imageInput": true,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": true,
    "contextWindow": 131072,
    "maxOutput": 32768,
    "inputCost": 0.286705,
    "outputCost": 1.14682
  },
  {
    "model": "alibaba-cn/qwen3-vl-30b-a3b",
    "imageInput": true,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": true,
    "contextWindow": 131072,
    "maxOutput": 32768,
    "inputCost": 0.108,
    "outputCost": 0.431
  },
  {
    "model": "alibaba-cn/qwen3-vl-plus",
    "imageInput": true,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": true,
    "contextWindow": 262144,
    "maxOutput": 32768,
    "inputCost": 0.143353,
    "outputCost": 1.433525
  },
  {
    "model": "alibaba-cn/qwq-32b",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": true,
    "contextWindow": 131072,
    "maxOutput": 8192,
    "inputCost": 0.287,
    "outputCost": 0.861
  },
  {
    "model": "alibaba-cn/qwq-plus",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": true,
    "reasoning": true,
    "contextWindow": 131072,
    "maxOutput": 8192,
    "inputCost": 0.23,
    "outputCost": 0.574
  },
  {
    "model": "alibaba-cn/tongyi-intent-detect-v3",
    "imageInput": false,
    "audioInput": false,
    "videoInput": false,
    "toolUsage": false,
    "reasoning": false,
    "contextWindow": 8192,
    "maxOutput": 1024,
    "inputCost": 0.058,
    "outputCost": 0.144
  }
]}
/>

## Advanced Configuration

### Custom Headers

```typescript
const agent = new Agent({
  name: "custom-agent",
  model: {
    url: "https://dashscope.aliyuncs.com/compatible-mode/v1",
    id: "alibaba-cn/deepseek-r1",
    apiKey: process.env.DASHSCOPE_API_KEY,
    headers: {
      "X-Custom-Header": "value"
    }
  }
});
```

### Dynamic Model Selection

```typescript
const agent = new Agent({
  name: "dynamic-agent",
  model: ({ runtimeContext }) => {
    const useAdvanced = runtimeContext.task === "complex";
    return useAdvanced
      ? "alibaba-cn/tongyi-intent-detect-v3"
      : "alibaba-cn/deepseek-r1";
  }
});
```




---
title: "Alibaba | Models | Mastra"
description: "Use Alibaba models with Mastra. 39 models available."
---

{/* This file is auto-generated by generate-model-docs.ts - DO NOT EDIT MANUALLY */}