# @llmgateway/models 中文文档

规范地址：https://npmcn.com/package/%40llmgateway/models/

版本：1\.389\.1
npm 元数据更新时间：2026-11-01T16:39:40.506Z
中文译文更新时间：2026-11-01T18:10:25.191Z
软件包许可：SEE LICENSE IN \.\./\.\./LICENSE

本文由上游 README 机器翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40llmgateway/models
原文对照：https://npmcn.com/package/%40llmgateway/models/?lang=original
项目主页：https://github.com/theopenco/llmgateway#readme
源码仓库：https://github.com/theopenco/llmgateway

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：3.4 MB，200 个文件
- 模块格式：ES Module
- TypeScript 类型：包内自带
- 运行依赖：0 个
- 首次发布：2026-01-24T17:25:31.235Z
- 最新版本发布：2026-11-01T16:39:40.196Z
- 已发布版本数：592（近 12 个月 592 个）

## 中文简介

的模型和提供程序定义 [LLM网关](https://llmgateway.io/) -所有LLM提供商的统一API。

## 安装

```sh
npm install @llmgateway/models
```

也可以使用：`pnpm add @llmgateway/models`、`yarn add @llmgateway/models`、`bun add @llmgateway/models`

## README

# @llmgateway /模型

的模型和提供程序定义 [LLM网关](https://llmgateway.io/) -所有LLM提供商的统一API。

## 安装

```bash
npm install @llmgateway/models
```

## 使用

### 模型

这个 `models` 数组包含所有支持的LLM模型及其定价和提供商映射：

```typescript
import { models } from "@llmgateway/models";

// Find a specific model
const gpt4 = models.find((m) => m.id === "gpt-4o");

console.log(gpt4.id); // "gpt-4o"
console.log(gpt4.family); // "openai"
console.log(gpt4.contextSize); // 128000
console.log(gpt4.providers); // Provider mappings with pricing
```

#### 模型属性

| 财产 | 类型 | 描述 |
| --- | --- | --- |
| `id` | `string` | 唯一的模型标识符 |
| `family` | `string` | 模范家庭（openai、anthropic、谷歌等） |
| `contextSize` | `number` | 令牌中的最大上下文窗口 |
| `maxOutput` | `number` | 最大输出令牌 |
| `providers` | `ProviderModelMapping[]` | 提供定价的供应商 |
| `supportsImages` | `boolean` | 模型是否支持图像输入 |
| `supportsTools` | `boolean` | 模型是否支持工具/函数调用 |
| `supportsReasoning` | `boolean` | 模型是否支持扩展推理 |
| `free` | `boolean` | 模型是否可以免费使用 |

#### 提供者映射属性

| 财产 | 类型 | 描述 |
| --- | --- | --- |
| `providerId` | `string` | 提供者标识符 |
| `externalId` | `string` | 上游提供商模型id |
| `inputPrice` | `number` | 每个输入代币的价格（美元） |
| `outputPrice` | `number` | 每个输出代币的价格（美元） |
| `cachedInputPrice` | `number` | 每个缓存输入令牌的价格（美元） |
| `contextSize` | `number` | 特定于提供程序的上下文大小 |
| `maxOutput` | `number` | 特定于提供者的最大输出 |

### 供应商

这个 `providers` 数组包含所有支持的LLM提供程序：

```typescript
import { providers } from "@llmgateway/models";

// List all providers
providers.forEach((p) => {
  console.log(`${p.name}: ${p.description}`);
});

// Find a specific provider
const openai = providers.find((p) => p.id === "openai");
console.log(openai.name); // "OpenAI"
console.log(openai.website); // "https://openai.com"
```

#### 提供程序属性

| 财产 | 类型 | 描述 |
| --- | --- | --- |
| `id` | `string` | 唯一提供者标识符 |
| `name` | `string` | 显示名称 |
| `description` | `string` | 提供者描述 |
| `website` | `string` | 提供商网站URL |
| `streaming` | `boolean` | 提供商是否支持流媒体 |
| `color` | `string` | 品牌颜色（hex） |

## 支持供应商

-   OpenAI
-   人为
-   b谷歌AI工作室
-   谷歌顶点AI
-   Azure OpenAI
-   AWS基础
-   米斯特拉尔
-   DeepSeek
-   新品(欣赏)
-   困惑
-   和更多的……

## 完整型号清单

有关实时定价的完整模型列表，请访问 [llmgateway.io /模型](https://llmgateway.io/models).

## 许可证

看到 [许可证](https://github.com/theopenco/llmgateway/blob/main/LICENSE) 获取详细信息。

## 常见问题

### @llmgateway/models 是什么？

的模型和提供程序定义 LLM网关 -所有LLM提供商的统一API。

### 如何安装 @llmgateway/models？

在项目目录运行 npm install @llmgateway/models，或使用 pnpm add / yarn add / bun add。

### @llmgateway/models 支持 TypeScript 吗？

支持。包内自带 TypeScript 类型声明（package\.json 声明了 types 入口），安装后即可获得类型提示，无需再安装 @types 包。

### @llmgateway/models 支持 ESM 还是 CommonJS？

以 ES Module 形式发布，推荐使用 import 引入。在 CommonJS 项目中，Node\.js 20\.19\+ / 22\.12\+ 可以直接 require\(\) 不含顶层 await 的 ES Module，更早的版本需要改用动态 import\(\)。

### @llmgateway/models 可以商用吗？

@llmgateway/models 使用 SEE LICENSE IN \.\./\.\./LICENSE 许可。许可条款写在包内的独立文件中，请阅读该文件确认可否商用。以上为概括，不构成法律意见，请以许可原文为准。

### @llmgateway/models 还在维护吗？

最新版本 1\.389\.1 发布于 2026/11/02（1 天前）；至今共发布 592 个版本，其中过去 12 个月发布了 592 个；首次发布于 2026/01/25。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

