> ## Documentation Index
> Fetch the complete documentation index at: https://docs.routerlink.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# 模型

> 通过统一 API 发现并使用 RouterLink 当前支持的各厂商及路由渠道的模型目录。

# 模型

RouterLink 从实时注册表中暴露当前模型目录。随着模型和路由渠道的新增、更新或下线，目录数量会动态变化，请使用 `GET /api/v1/models` 返回的 `total` 字段作为准确数量的来源，而非硬编码某个模型数量。

完整目录请访问 [**https://routerlink.ai/models**](https://routerlink.ai/models)。

***

## API 参考

### 获取模型列表

返回抽象模型的分页列表，包含元数据、能力标签、路由渠道别名以及上下文/输出长度限制。

```http theme={null}
GET /api/v1/models
```

#### 参数

| 参数                | 类型         | 默认值    | 说明                                                           |
| ----------------- | ---------- | ------ | ------------------------------------------------------------ |
| `page`            | `int`      | `1`    | 页码                                                           |
| `page_size`       | `int`      | `20`   | 每页条数（最大 `100`）                                               |
| `model_name`      | `string`   | -      | 对模型显示名称进行大小写不敏感的模糊搜索                                         |
| `provider`        | `string`   | -      | 按单个路由渠道别名过滤（向后兼容）                                            |
| `providers`       | `string[]` | -      | 多选路由渠道过滤（最多 20 个值）                                           |
| `vendor`          | `string`   | -      | 按单个厂商/模型所有者过滤（向后兼容）                                          |
| `vendors`         | `string[]` | -      | 多选厂商过滤（最多 20 个值）                                             |
| `label`           | `string`   | -      | 按标签过滤：`Recommended`、`Flagship`、`Free for Now` 或 `Deprecated` |
| `tags`            | `string[]` | -      | 能力标签或模态过滤（最多 10 个值），如 `Text`、`Image`、`File`、`Audio`、`Video`  |
| `show_deprecated` | `bool`     | `true` | 是否在结果中包含已下线模型                                                |
| `context_min`     | `int`      | -      | 最小上下文窗口长度（token 数）                                           |
| `context_max`     | `int`      | -      | 最大上下文窗口长度（token 数）                                           |
| `output_min`      | `int`      | -      | 最小最大输出长度（token 数）                                            |
| `output_max`      | `int`      | -      | 最大输出长度（token 数）                                              |

数组参数请使用重复的查询键传递，例如 `vendors=OpenAI&vendors=Google`。

#### 示例

```bash theme={null}
curl "https://router-link.world3.ai/api/v1/models?page=1&page_size=20"
```

#### 响应

```json theme={null}
{
  "total": 66,
  "page": 1,
  "page_size": 1,
  "items": [
    {
      "id": 58,
      "model_name": "Gemini 3.1 Pro Preview",
      "vendor": "Google",
      "providers": "WORLD3 Router North America",
      "description": "Gemini 3.1 Pro Preview is Google's frontier reasoning model...",
      "label": "Recommended",
      "tags": "Text, Image, File, Audio, Video",
      "total_context": 1050000,
      "max_output": 65500,
      "is_free": false,
      "created_at": "2026-03-31T15:18:37",
      "updated_at": "2026-03-31T15:18:37"
    }
  ]
}
```

以上为示例响应结构，实时目录可能有所变化。

***

### 模型分组

返回指定模型在不同路由渠道下的实现，按 RouterLink API 兼容格式和路由渠道别名分组。该接口用于模型详情页，方便查看哪些渠道可以提供该模型。

```http theme={null}
GET /api/v1/models/group?model_name=Gemini%203.1%20Pro%20Preview
```

#### 响应结构

```json theme={null}
{
  "Gemini 3.1 Pro Preview": {
    "OpenAI": {
      "WORLD3 Router North America": [
        {
          "model_id": 1097,
          "model_name": "world3-router-north-america/google/gemini-3.1-pro-preview",
          "display_name": "Gemini 3.1 Pro Preview",
          "model_standard": "OpenAI",
          "provider": "WORLD3 Router North America",
          "endpoint": "https://router-link.world3.ai/api",
          "vendor": "Google",
          "total_context": 1050000,
          "max_output": 65500,
          "pricing": {
            "input": [
              {
                "token_min": 0,
                "token_max": 200000,
                "price_usd": "2.20000000000000",
                "price_wai_credit": 2200
              }
            ],
            "output": [
              {
                "token_min": 0,
                "token_max": 200000,
                "price_usd": "13.20000000000000",
                "price_wai_credit": 13200
              }
            ]
          }
        }
      ]
    }
  }
}
```

目前，公开的 `GET /api/v1/{model_standard}/models` 路由支持 `OpenAI`、`Anthropic` 等 RouterLink API 兼容格式。当您需要查看某个抽象模型的分组视图时，请使用 `/api/v1/models/group`。

***

### 提供商列表

返回所有可用的路由渠道别名，按字母顺序排序。路由渠道别名是路由渠道，不一定是模型厂商。

```http theme={null}
GET /api/v1/models/providers
```

```bash theme={null}
curl "https://router-link.world3.ai/api/v1/models/providers"
```

示例值包括 `OpenAI Channel`、`Anthropic Channel`、`GCP Vertex`、`WORLD3 Router North America` 和 `WORLD3 Router Asia Pacific`。

***

### 厂商列表

返回所有唯一厂商名称，按字母顺序排序。厂商是模型的所有者或模型系列，如 `OpenAI`、`Anthropic`、`Google`、`DeepSeek`、`Qwen` 等。

```http theme={null}
GET /api/v1/models/vendors
```

```bash theme={null}
curl "https://router-link.world3.ai/api/v1/models/vendors"
```

***

## 模型标签

**routerlink.ai/models** 上的模型带有标签，帮助您选择合适的模型：

| 标签             | 含义                |
| -------------- | ----------------- |
| `Recommended`  | 适用于大多数场景的推荐选择     |
| `Flagship`     | 某厂商或模型系列中的顶级能力模型  |
| `Free for Now` | 当前可免费使用（价格可能随时调整） |
| `Deprecated`   | 已停止维护，但仍保留兼容支持的模型 |

***

## 定价

RouterLink 在 `model_pricing` 表中以每模型、每路由渠道、每 token 类型的分级方式存储定价。定价信息可通过返回模型实现信息的接口获取，例如 `GET /api/v1/models/group` 和 `GET /api/v1/{model_standard}/models?with_price=true`。

每条定价记录包含：

| 字段                 | 说明                                     |
| ------------------ | -------------------------------------- |
| `token_min`        | 该计费档位的 token 数下限（含）                    |
| `token_max`        | 该计费档位的 token 数上限（含）；`null` 表示不限上限      |
| `price_usd`        | 该档位每 1,000,000 token 的美元单价             |
| `price_wai_credit` | 该档位每 1,000,000 token 的 RouterLink 积分单价 |

注册表支持的 token 类型目前包括：

| Token 类型                                                        | 说明              |
| --------------------------------------------------------------- | --------------- |
| `input`                                                         | 输入文本 token      |
| `output`                                                        | 输出文本 token      |
| `cache_read`                                                    | 已缓存输入 token 的读取 |
| `cache_write`                                                   | 已缓存输入 token 的写入 |
| `input_audio` / `output_audio`                                  | 音频输入或输出 token   |
| `input_image` / `output_image`                                  | 图像输入或输出单位/token |
| `input_video` / `output_video`                                  | 视频输入或输出单位/token |
| `input_audio_cache` / `input_image_cache` / `input_video_cache` | 已缓存的模态专属输入      |
| `output_per_audio` / `output_per_image` / `output_per_video`    | 按输出媒体单位计费       |

价格为 `0` 表示该档位免费。

***

## 聊天补全请求参数

调用 `POST /api/v1/chat/completions` 时，支持的参数取决于目标模型和路由渠道。常用的 OpenAI 兼容参数包括：

| 参数                                     | 说明                            |
| -------------------------------------- | ----------------------------- |
| `model`                                | 目标 RouterLink 模型标识符           |
| `messages`                             | 对话数组                          |
| `temperature`                          | 输出随机性                         |
| `top_p`                                | 核采样                           |
| `n`                                    | 生成的补全数量                       |
| `max_tokens` / `max_completion_tokens` | 最大补全长度                        |
| `stop`                                 | 自定义停止序列                       |
| `stream` / `stream_options`            | 流式输出控制                        |
| `presence_penalty`                     | 鼓励话题多样性                       |
| `frequency_penalty`                    | 减少重复内容                        |
| `logit_bias`                           | 调整 token 概率                   |
| `logprobs` / `top_logprobs`            | token 对数概率控制                  |
| `tools`                                | 函数/工具定义                       |
| `tool_choice`                          | 控制工具选择行为                      |
| `parallel_tool_calls`                  | 允许或禁用并行工具调用                   |
| `response_format`                      | 响应格式控制，支持模型的 JSON/schema 格式输出 |
| `modalities` / `audio`                 | 支持模型的多模态输出控制                  |
| `reasoning_effort`                     | 支持模型的推理力度                     |
| `web_search_options`                   | 支持模型的网络搜索选项                   |
| `metadata`                             | 调用方提供的元数据                     |
| `service_tier`                         | 提供商专属服务等级                     |
| `store`                                | 支持时的提供商侧存储偏好                  |
| `verbosity`                            | 支持时的详细程度控制                    |

部分渠道可能接受提供商特有的额外字段，但可移植的行为应基于上述参数以及目标模型的能力。

***

## 数据模型

RouterLink 在三个核心表中维护统一的 MySQL 注册表：

| 表名               | 用途                                               |
| ---------------- | ------------------------------------------------ |
| `model`          | 路由渠道实现行：模型标识符、路由渠道、API 兼容格式、端点、上下文窗口、输出长度限制及激活状态 |
| `model_pricing`  | 每路由渠道、每 token 类型的定价分级                            |
| `model_metadata` | 抽象模型元数据：厂商、提供商列表、标签、标识、描述及显示名称                   |

第四张表 **`model_fallback_chains`** 定义提供商故障转移行为。当主提供商耗尽时，网关可按 `priority` 排序的下一个启用的故障转移条目重试。

***

## 提供商与厂商

RouterLink 将“路由渠道”和“模型厂商”作为两个独立概念：

| 概念       | 含义               | 示例                                                          |
| -------- | ---------------- | ----------------------------------------------------------- |
| 路由渠道     | 处理请求的路由渠道        | `WORLD3 Router North America`、`GCP Vertex`、`OpenAI Channel` |
| 厂商       | 模型所有者或模型系列       | `OpenAI`、`Anthropic`、`Google`、`DeepSeek`、`Qwen`             |
| API 兼容格式 | 模型实现使用的 API 兼容格式 | `OpenAI`、`Anthropic`                                        |

使用 `GET /api/v1/models/providers` 和 `GET /api/v1/models/vendors` 获取当前实时列表。
