调用 GET /api/v1/models 接口查询百炼平台上可用的模型列表,支持按模型作者、模态类型、模型能力、部署模式等条件筛选,并获取模型的定价和上下文长度等信息。
前提条件
已创建 API Key 并配置为环境变量 DASHSCOPE_API_KEY。配置方法请参见配置API Key到环境变量。
请求说明
-
HTTP 方法:GET
-
请求地址
调用时请将
{WorkspaceId}替换为您的业务空间 ID。地域
Endpoint
华北2(北京)
https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/models新加坡
https://dashscope-intl.aliyuncs.com/api/v1/models中国香港
https://cn-hongkong.dashscope.aliyuncs.com/api/v1/models德国(法兰克福)
https://{WorkspaceId}.eu-central-1.maas.aliyuncs.com/api/v1/models日本(东京)
https://{WorkspaceId}.ap-northeast-1.maas.aliyuncs.com/api/v1/models美国(弗吉尼亚)
https://dashscope-us.aliyuncs.com/api/v1/models -
认证方式
在请求 Header 中设置
Authorization: Bearer {API_KEY}。
请求参数
所有参数均通过 Query String 传递。
|
参数 |
类型 |
必选 |
描述 |
|
providers |
Array[String] |
否 |
按模型作者筛选。可选值:
示例: |
|
inference_providers |
Array[String] |
否 |
按推理服务供应商筛选。可选值:
|
|
capabilities |
Array[String] |
否 |
按模态类型筛选。可选值:
示例: |
|
features |
Array[String] |
否 |
按模型能力筛选。可选值:
|
|
context_window |
Integer |
否 |
按上下文长度筛选,返回上下文长度大于等于该值的模型。示例: |
|
service_site |
String |
否 |
按部署模式筛选。不传时返回所有部署模式的模型。可选值:
|
|
supports |
Array[String] |
否 |
按模型支持的应用场景筛选。默认值:
|
|
deployment_methods |
Array[String] |
否 |
按部署方式筛选。可选值:
|
|
deployment_ptu_service_tiers |
Array[String] |
否 |
按 PTU 类型筛选,使用时需同时设置 |
|
name |
String |
否 |
按模型名称进行模糊搜索。示例: |
|
model |
String |
否 |
按模型 ID 进行精确查询。示例: |
|
language |
String |
否 |
返回结果的语言。可选值: |
|
page_no |
Integer |
否 |
页码,从 1 开始。默认值: |
|
page_size |
Integer |
否 |
每页返回的模型数量。默认值: |
返回参数
|
参数 |
类型 |
描述 |
|
request_id |
String |
请求 ID,用于问题排查。 |
|
output.total |
Number |
符合条件的模型总数。 |
|
output.page_no |
Number |
当前页码。 |
|
output.page_size |
Number |
每页条数。 |
|
output.models[].model |
String |
模型 ID,用于 API 调用时指定模型。 |
|
output.models[].name |
String |
模型的显示名称。 |
|
output.models[].description |
String |
模型的功能描述。 |
|
output.models[].provider |
String |
模型作者,如 |
|
output.models[].inference_provider |
String |
推理服务供应商,如 |
|
output.models[].capabilities |
Array[String] |
模型支持的模态类型,取值与请求参数 |
|
output.models[].features |
Array[String] |
模型支持的能力列表,取值与请求参数 |
|
output.models[].published_time |
String |
模型发布时间,格式: |
|
output.models[].inference_metadata |
Object |
模型的输入输出模态信息,包含以下字段:
|
|
output.models[].model_info |
Object |
模型的上下文长度信息,包含以下字段(值为
|
|
output.models[].prices |
Array[Object] |
模型定价信息。每个元素包含:
|
请求示例
示例一:查询所有文本生成模型
curl "https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/models?capabilities=TG&page_no=1&page_size=20" \
--header "Authorization: Bearer $DASHSCOPE_API_KEY" \
--header "Content-Type: application/json"
示例二:查询 Qwen 系列的推理模型
curl "https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/models?providers=qwen&capabilities=TG&capabilities=Reasoning&page_no=1&page_size=100" \
--header "Authorization: Bearer $DASHSCOPE_API_KEY" \
--header "Content-Type: application/json"
返回示例
{
"code": null,
"message": null,
"success": true,
"output": {
"total": 168,
"page_no": 1,
"page_size": 10,
"models": [
{
"model": "qwen3-max",
"name": "通义千问3-Max",
"description": "通义千问3系列Max模型,适配场景更加复杂的智能体需求。",
"features": [
"function-calling",
"structured-outputs",
"web-search"
],
"prices": [
{
"prices": [
{
"type": "input_token",
"price": "2",
"price_unit": "每百万tokens",
"price_name": "输入"
},
{
"type": "output_token",
"price": "8",
"price_unit": "每百万tokens",
"price_name": "输出"
}
],
"range_name": "Default"
}
],
"published_time": "2025-11-11 12:00:00",
"inference_metadata": {
"response_modality": ["Text"],
"request_modality": ["Text"]
},
"model_info": {
"context_window": 131072,
"max_input_tokens": 130048,
"max_output_tokens": 16384,
"max_reasoning_tokens": null
}
},
{
"model": "qwen-image-max",
"name": "Qwen-Image-Max",
"description": "通义千问图像生成模型Max系列。",
"features": ["model-experience"],
"prices": [
{
"prices": [
{
"type": "image_number",
"price": "0.075",
"price_unit": "每张",
"price_name": "图像生成"
}
],
"range_name": "Default"
}
],
"published_time": null,
"inference_metadata": {
"response_modality": ["Image"],
"request_modality": ["Text"]
},
"model_info": {
"context_window": null,
"max_input_tokens": null,
"max_output_tokens": null,
"max_reasoning_tokens": null
}
}
]
},
"request_id": "d5f5201f-ee7a-9e3d-8569-bc0eedec21f9"
}
错误码
如果调用失败,会返回错误信息。更多错误码及解决方法,请参见错误信息。