> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.openmodels.market/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.openmodels.market/_mcp/server.

# 模型定价 API

使用 `GET https://api.getopenmodels.com/v1/models` 查询当前模型目录和所有模型定价字段。当你的应用需要实时价格，而不是复制模型表中的值时，请使用此端点。

```bash
curl https://api.getopenmodels.com/v1/models
```

响应会返回一个 `data` 数组。每一项代表一个模型，包含模型元数据、可用状态、支持的能力和定价。

## 定价字段

`pricing` 可以是单个对象，也可以是阶梯对象数组。两种结构都应视为有效。

| 字段                 | 单位                      |
| ------------------ | ----------------------- |
| `prompt`           | 每个输入 token 的 USD 价格     |
| `completion`       | 每个输出 token 的 USD 价格     |
| `input_cache_read` | 每个缓存输入 token 读取的 USD 价格 |
| `request`          | 每次请求的 USD 价格            |
| `image`            | 每张图片的 USD 价格            |
| `duration`         | 适用时按时长计价的路由值            |

对于 token 价格，乘以 `1,000,000` 即可显示模型表中类似 `/1M` 的值。`0` 值表示该模型不使用这个计价单位。

## 阶梯定价

当 `pricing` 是数组时，每一项都是一个定价阶梯。`range_start` 和 `range_end` 会在模型使用基于区间的定价时定义阶梯边界。`range_end: null` 表示该阶梯没有上限。

```json
{
  "id": "qwen3.5-flash",
  "name": "qwen3.5-flash",
  "context_length": 1000000,
  "pricing": [
    {
      "range_start": 0,
      "range_end": 128000,
      "prompt": "0.000000029",
      "completion": "0.000000294",
      "image": "0",
      "request": "0",
      "duration": "0",
      "input_cache_read": "0.000000003"
    }
  ],
  "is_ready": true,
  "is_free": false
}
```

## 常用字段

| 字段                                       | 含义                 |
| ---------------------------------------- | ------------------ |
| `id`                                     | 在请求体中发送的模型 ID      |
| `input_modalities` / `output_modalities` | 受支持的输入和输出模态        |
| `context_length`                         | 可用时的最大上下文窗口        |
| `max_output_length`                      | 可用时的最大生成输出长度       |
| `supported_sampling_parameters`          | 模型可接受的请求参数         |
| `supported_features`                     | 工具调用、推理、视觉或图片生成等能力 |
| `is_ready`                               | 模型当前是否可接收流量        |
| `is_free`                                | 模型当前是否免费           |

## 相关文档

* [模型](/docs/models-pricing/models)：浏览当前受支持的模型表。
* [定价指南](/docs/models-pricing/pricing-guide)：根据返回的定价值估算请求成本。