# 查询模型目录

```{raw} html
<div class="mo-api-page-show-toc" aria-hidden="true"></div>
```

查询当前用户可见模型的名称、能力、报价和启用状态。

```text
GET https://billing.moi.matrixorigin.cn/api/v1/taas/models
```

## 调用前准备

准备个人访问令牌。创建和管理方法参阅[创建和管理个人访问令牌](../../../../../guides/genesis/api-keys.md#创建和管理个人访问令牌)。

查询范围为当前用户有权访问的数据。

## 查询参数

将示例中的 `$MOI_PERSONAL_ACCESS_TOKEN` 替换为个人访问令牌。

:::::::{div} mo-api-tabs
::::::{tab-set}
:::::{tab-item} 输入示例

```bash
curl --get "https://billing.moi.matrixorigin.cn/api/v1/taas/models" \
  -H "X-API-Key: $MOI_PERSONAL_ACCESS_TOKEN" \
  --data-urlencode "page_size=2"
```

将响应中的 `next_page_token` 保存为 `$NEXT_PAGE_TOKEN`，保持筛选条件不变并请求下一页。该值为空或省略时停止翻页。

```bash
curl --get "https://billing.moi.matrixorigin.cn/api/v1/taas/models" \
  -H "X-API-Key: $MOI_PERSONAL_ACCESS_TOKEN" \
  --data-urlencode "page_size=2" \
  --data-urlencode "page_token=$NEXT_PAGE_TOKEN"
```

:::::
:::::{tab-item} 参数说明

::::{div} mo-api-parameter-table

| 参数 | 类型 | 是否必填 | 说明 |
| --- | --- | --- | --- |
| `type` | string | 否 | 模型类型筛选。 |
| `status` | string | 否 | 模型启用状态筛选。 |
| `q` | string | 否 | 按名称、别名、描述、系列、类型或供应商名称搜索。 |
| `search` | string | 否 | 未填写 `q` 时使用的搜索词。 |
| `pricing_status` | string | 否 | 报价筛选：`priced` 或 `unpriced`。 |
| `logos` | string | 否 | 按模型系列筛选；可重复传递或用逗号分隔。 |
| `logo` | string | 否 | `logos` 的兼容参数，可与 `logos` 合并使用。 |
| `search_logos` | string | 否 | 将系列匹配加入搜索条件；可重复传递或用逗号分隔。 |
| `search_types` | string | 否 | 将类型匹配加入搜索条件；可重复传递或用逗号分隔。 |
| `context_max` | integer | 否 | 仅返回上下文窗口大于 0 且不超过该值的模型。 |
| `health_status` | string | 否 | 健康状态筛选；`all` 不限制。 |
| `page_size` | integer | 否 | 每页数量，默认 100，最大 1000。 |
| `page_token` | string | 否 | 上一页返回的下一页标记；首个请求省略。 |

::::

:::::
::::::
:::::::

## 成功响应

返回 HTTP `200`，响应包含当前用户可见的模型目录。

:::::::{div} mo-api-tabs mo-api-response-tabs
::::::{tab-set}
:::::{tab-item} 响应示例

```json
{
  "items": [
    {
      "id": "model_example",
      "name": "example-chat-model",
      "alias": "Example Chat",
      "logo": "example",
      "description": "Example chat model.",
      "type": "chat",
      "native_types": [
        "chat"
      ],
      "capabilities": [
        "chat"
      ],
      "context_window": 32768,
      "input_price_per_million": "0",
      "output_price_per_million": "0",
      "cache_creation_price_per_million": "0",
      "cache_hit_price_per_million": "0",
      "ocr_price_per_page": "0",
      "image_price_per_image": "0",
      "image_hd_price_per_image": "0",
      "video_price_per_second": "0",
      "video_hd_price_per_second": "0",
      "tts_price_per_10k_chars": "0",
      "tts_hd_price_per_10k_chars": "0",
      "asr_price_per_minute": "0",
      "asr_realtime_price_per_minute": "0",
      "currency": "CNY",
      "parameters": "7B",
      "max_output_tokens": 8192,
      "visibility": "public",
      "allowed_user_ids": [
        "user_example"
      ],
      "status": "enabled",
      "health_status": "healthy",
      "created_at": 1788710400,
      "updated_at": 1788710400
    }
  ],
  "total": 1,
  "next_page_token": ""
}
```

:::::
:::::{tab-item} 字段说明

| 字段 | 类型 | 说明 |
| --- | --- | --- |
| `items` | array of object | 本页记录。 |
| `items[].id` | string | 模型目录对象 ID，用于模型健康状态等管理查询。 |
| `items[].name` | string | 模型调用名称。 |
| `items[].alias` | string | 模型显示别名；未设置时省略。 |
| `items[].logo` | string | 模型系列标识；未设置时省略。 |
| `items[].description` | string | 模型说明；未设置时省略。 |
| `items[].type` | string | 模型类型。 |
| `items[].native_types` | array of string | 模型关联的原生类型；未设置时省略。 |
| `items[].capabilities` | array of string | 模型支持的调用能力；未设置时省略。 |
| `items[].context_window` | integer | 上下文窗口 Token 数；未设置时省略。 |
| `items[].input_price_per_million` | string | 每百万输入 Token 的价格。 未设置时可省略。 |
| `items[].output_price_per_million` | string | 每百万输出 Token 的价格。 未设置时可省略。 |
| `items[].cache_creation_price_per_million` | string | 每百万缓存写入 Token 的价格。 未设置时可省略。 |
| `items[].cache_hit_price_per_million` | string | 每百万缓存读取 Token 的价格。 未设置时可省略。 |
| `items[].ocr_price_per_page` | string | 每页 OCR 的价格。 未设置时可省略。 |
| `items[].image_price_per_image` | string | 每张图片的价格。 未设置时可省略。 |
| `items[].image_hd_price_per_image` | string | 每张高清图片的价格。 未设置时可省略。 |
| `items[].video_price_per_second` | string | 每秒视频的价格。 未设置时可省略。 |
| `items[].video_hd_price_per_second` | string | 每秒高清视频的价格。 未设置时可省略。 |
| `items[].tts_price_per_10k_chars` | string | 每万字符语音合成价格。 未设置时可省略。 |
| `items[].tts_hd_price_per_10k_chars` | string | 每万字符高清语音合成价格。 未设置时可省略。 |
| `items[].asr_price_per_minute` | string | 每分钟语音识别价格。 未设置时可省略。 |
| `items[].asr_realtime_price_per_minute` | string | 每分钟实时语音识别价格。 未设置时可省略。 |
| `items[].currency` | string | 模型报价使用的货币。 |
| `items[].parameters` | string | 模型参数规模说明；未设置时省略。 |
| `items[].max_output_tokens` | integer | 最大输出 Token 数；未设置时省略。 |
| `items[].visibility` | string | 模型可见范围。 |
| `items[].allowed_user_ids` | array of string | 私有模型允许的用户 ID；未设置时省略。 |
| `items[].status` | string | 模型启用状态。 |
| `items[].health_status` | string | 最近汇总的模型健康状态。 |
| `items[].created_at` | integer | 创建时间，Unix 秒。 |
| `items[].updated_at` | integer | 更新时间，Unix 秒。 |
| `total` | integer | 符合筛选条件的总记录数。 |
| `next_page_token` | string | 下一页标记；为空或省略时已到最后一页。 |

字段路径中的 `[]` 表示数组中的每一项。

:::::
::::::
:::::::

本接口按当前用户的目录可见范围返回模型。调用模型时，使用模型调用接口接受的名称；可通过 Genesis 的模型列表确认当前调用凭据可用的模型。

## 后续操作

使用 `items[].id` [查询模型健康状态](get-model-health.md)。
