docs: make Chinese README the default
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
<!-- WEHUB_ZH_README -->
|
||||
> [!NOTE]
|
||||
> 本文档由 WeHub 基于上游 README 翻译整理,属于社区翻译,非官方中文文档。
|
||||
> [English](./README.en.md) · [原始项目](https://github.com/anomalyco/models.dev) · [上游 README](https://github.com/anomalyco/models.dev/blob/HEAD/README.md)
|
||||
> 原作者、版权与许可证归属以原始项目及本仓库 LICENSE 文件为准。
|
||||
|
||||
<p align="center">
|
||||
<a href="https://models.dev">
|
||||
<picture>
|
||||
@@ -10,27 +16,27 @@
|
||||
|
||||
---
|
||||
|
||||
[Models.dev](https://models.dev) is a comprehensive open-source database of AI model specifications, pricing, and capabilities.
|
||||
[Models.dev](https://models.dev) 是一个全面的开源 AI 模型规格、定价与能力数据库。
|
||||
|
||||
There's no single database with information about all the available AI models. We started Models.dev as a community-contributed project to address this. We also use it internally in [opencode](https://opencode.ai).
|
||||
目前没有一个数据库能涵盖所有可用 AI 模型的信息。我们发起 Models.dev,作为一个社区贡献项目来解决这一问题。我们也在 [opencode](https://opencode.ai). 内部使用它。
|
||||
|
||||
## API
|
||||
|
||||
You can access this data through an API.
|
||||
你可以通过 API 访问这些数据。
|
||||
|
||||
```bash
|
||||
curl https://models.dev/api.json
|
||||
```
|
||||
|
||||
Use the **Model ID** field to do a lookup on any model; it's the identifier used by [AI SDK](https://ai-sdk.dev/).
|
||||
使用 **Model ID** 字段查询任意模型;这是 [AI SDK](https://ai-sdk.dev/). 使用的标识符。
|
||||
|
||||
Provider-agnostic model metadata is available separately:
|
||||
与提供商无关(provider-agnostic)的模型元数据可单独获取:
|
||||
|
||||
```bash
|
||||
curl https://models.dev/models.json
|
||||
```
|
||||
|
||||
Use this for facts about the model itself, independent of where it is served. If you need both provider endpoints and model-only metadata in one response:
|
||||
用于获取模型本身的事实信息,与由何处提供服务无关。若需要在一个响应中同时获取提供商端点与仅含模型的元数据:
|
||||
|
||||
```bash
|
||||
curl https://models.dev/catalog.json
|
||||
@@ -38,33 +44,33 @@ curl https://models.dev/catalog.json
|
||||
|
||||
### Logos
|
||||
|
||||
Provider logos are available as SVG files:
|
||||
提供商标志以 SVG 文件形式提供:
|
||||
|
||||
```bash
|
||||
curl https://models.dev/logos/{provider}.svg
|
||||
```
|
||||
|
||||
Replace `{provider}` with the **Provider ID** (e.g., `anthropic`, `openai`, `google`). If we don't have a provider's logo, a default logo is served instead.
|
||||
将 `{provider}` 替换为 **Provider ID**(例如 `anthropic`、`openai`、`google`)。若我们没有某提供商的标志,将返回默认标志。
|
||||
|
||||
## Contributing
|
||||
|
||||
The data is stored in the repo as TOML files; organized by provider and model. The logo is stored as an SVG. This is used to generate this page and power the API.
|
||||
数据以 TOML 文件形式存储在仓库中,按提供商和模型组织。标志存储为 SVG。这些内容用于生成本页面并驱动 API。
|
||||
|
||||
We need your help keeping the data up to date.
|
||||
我们需要你的帮助来保持数据最新。
|
||||
|
||||
### Adding Model Metadata
|
||||
|
||||
Model-only facts live in `models/`, using the same path-style IDs as provider models. For example, `models/openai/gpt-5.toml` defines metadata for the underlying GPT-5 model, while `providers/openai/models/gpt-5.toml` defines OpenAI-specific serving details such as pricing.
|
||||
仅含模型的事实信息存放在 `models/`,使用与提供商模型相同的路径式 ID。例如,`models/openai/gpt-5.toml` 定义底层 GPT-5 模型的元数据,而 `providers/openai/models/gpt-5.toml` 定义 OpenAI 特定的服务详情(如定价)。
|
||||
|
||||
Use model metadata for provider-agnostic facts:
|
||||
将模型元数据用于与提供商无关的事实:
|
||||
|
||||
- `name`, `family`, `release_date`, `last_updated`, `knowledge`
|
||||
- `attachment`, `reasoning`, `tool_call`, `structured_output`, `temperature`
|
||||
- `[limit]` defaults like context, input, and output token limits
|
||||
- `[modalities]` defaults
|
||||
- `open_weights`, `license`, `links`, `weights`, and `benchmarks`
|
||||
- `name`、`family`、`release_date`、`last_updated`、`knowledge`
|
||||
- `attachment`、`reasoning`、`tool_call`、`structured_output`、`temperature`
|
||||
- `[limit]` 默认值,如上下文、输入与输出 token 限制
|
||||
- `[modalities]` 默认值
|
||||
- `open_weights`、`license`、`links`、`weights` 以及 `benchmarks`
|
||||
|
||||
Example:
|
||||
示例:
|
||||
|
||||
```toml
|
||||
name = "GPT-5"
|
||||
@@ -99,7 +105,7 @@ url = "https://huggingface.co/example/model"
|
||||
format = "safetensors"
|
||||
```
|
||||
|
||||
Provider TOMLs can inherit these facts with `base_model` and then keep only provider-specific fields or overrides:
|
||||
提供商 TOML 可通过 `base_model` 继承这些事实,然后仅保留提供商特定字段或覆盖项:
|
||||
|
||||
```toml
|
||||
base_model = "openai/gpt-5"
|
||||
@@ -114,18 +120,18 @@ context = 200_000 # optional provider override
|
||||
output = 32_000
|
||||
```
|
||||
|
||||
Provider fields win over model metadata during generation. Use this when the underlying model is the same but a provider serves it with different context limits, modalities, features, or pricing.
|
||||
生成时,提供商字段优先于模型元数据。当底层模型相同,但提供商以不同的上下文限制、模态、功能或定价提供服务时,请使用此方式。
|
||||
|
||||
### Adding a New Provider Model
|
||||
|
||||
To add a new model, start by checking if the provider already exists in the `providers/` directory. If not, then:
|
||||
要添加新模型,请先检查该提供商是否已存在于 `providers/` 目录中。若不存在,则:
|
||||
|
||||
#### 1. Create a Provider
|
||||
|
||||
If the provider isn't already in `providers/`:
|
||||
若提供商尚未在 `providers/` 中:
|
||||
|
||||
1. Create a new folder in `providers/` with the provider's ID. For example, `providers/newprovider/`.
|
||||
2. Add a `provider.toml` with the provider details:
|
||||
1. 在 `providers/` 中创建一个以提供商 ID 命名的新文件夹。例如 `providers/newprovider/`。
|
||||
2. 添加包含提供商详情的 `provider.toml`:
|
||||
|
||||
```toml
|
||||
name = "Provider Name"
|
||||
@@ -134,7 +140,7 @@ If the provider isn't already in `providers/`:
|
||||
doc = "https://example.com/docs/models" # Link to provider's documentation
|
||||
```
|
||||
|
||||
If the provider doesn’t publish an npm package but exposes an OpenAI-compatible endpoint, set the npm field accordingly and include the base URL:
|
||||
若提供商未发布 npm 包,但暴露了 OpenAI 兼容端点,请相应设置 npm 字段并包含 base URL:
|
||||
|
||||
```toml
|
||||
npm = "@ai-sdk/openai-compatible" # Use OpenAI-compatible SDK
|
||||
@@ -143,12 +149,12 @@ If the provider isn't already in `providers/`:
|
||||
|
||||
#### 2. Add a Logo (optional)
|
||||
|
||||
To add a logo for the provider:
|
||||
要为提供商添加标志:
|
||||
|
||||
1. Add a `logo.svg` file to the provider's directory (e.g., `providers/newprovider/logo.svg`)
|
||||
2. Use SVG format with no fixed size or colors - use `currentColor` for fills/strokes
|
||||
1. 在提供商目录中添加 `logo.svg` 文件(例如 `providers/newprovider/logo.svg`)
|
||||
2. 使用 SVG 格式,不固定尺寸或颜色——填充/描边使用 `currentColor`
|
||||
|
||||
Example SVG structure:
|
||||
SVG 结构示例:
|
||||
|
||||
```svg
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
|
||||
@@ -158,9 +164,9 @@ Example SVG structure:
|
||||
|
||||
#### 3. Add a Model Definition
|
||||
|
||||
Create a new TOML file in the provider's `models/` directory where the filename is the model ID.
|
||||
在提供商的 `models/` 目录中创建新的 TOML 文件,文件名为模型 ID。
|
||||
|
||||
If the model ID contains `/`, use subfolders. For example, for the model ID `openai/gpt-5`, create a folder `openai/` and place a file named `gpt-5.toml` inside it.
|
||||
若模型 ID 包含 `/`,请使用子文件夹。例如,对于模型 ID `openai/gpt-5`,创建文件夹 `openai/`,并在其中放置名为 `gpt-5.toml` 的文件。
|
||||
|
||||
```toml
|
||||
name = "Model Display Name"
|
||||
@@ -198,9 +204,9 @@ field = "reasoning_content" # Name of the interleaved field "reasoning_content"
|
||||
|
||||
#### 3a. Reuse Model Metadata with `base_model`
|
||||
|
||||
For wrapper providers that mirror an existing model, prefer referencing the model-only metadata instead of duplicating provider-agnostic fields.
|
||||
对于镜像现有模型的封装提供商(wrapper provider),优先引用仅含模型的元数据,而不是重复与提供商无关的字段。
|
||||
|
||||
Use `base_model` when the provider serves the same underlying model and only provider-specific fields differ.
|
||||
当提供商提供相同的底层模型,且仅提供商特定字段不同时,使用 `base_model`。
|
||||
|
||||
```toml
|
||||
base_model = "anthropic/claude-opus-4-6"
|
||||
@@ -210,96 +216,96 @@ input = 5.00
|
||||
output = 25.00
|
||||
```
|
||||
|
||||
Rules:
|
||||
规则:
|
||||
|
||||
- `base_model` must point to a TOML file in `models/` using `<provider>/<model-id>`.
|
||||
- You can override any top-level model field locally.
|
||||
- If you override a nested table like `[cost]`, `[limit]`, or `[modalities]`, include the full values needed for that table.
|
||||
- `base_model_omit` is optional and removes inherited model metadata fields after local overrides are merged. Use dot-path strings, for example `base_model_omit = ["limit.input"]`.
|
||||
- `id` still comes from the filename; do not add it to the TOML.
|
||||
- `base_model` 必须指向 `models/` 中的 TOML 文件,使用 `<provider>/<model-id>`。
|
||||
- 你可以在本地覆盖任何顶层模型字段。
|
||||
- 若覆盖嵌套表(如 `[cost]`、`[limit]` 或 `[modalities]`),请包含该表所需的完整值。
|
||||
- `base_model_omit` 为可选项,在合并本地覆盖后会移除继承的模型元数据字段。使用点路径字符串,例如 `base_model_omit = ["limit.input"]`。
|
||||
- `id` 仍来自文件名;请勿将其添加到 TOML 中。
|
||||
|
||||
Use `base_model` when the wrapper model is materially the same as the source model and only differs by provider-specific pricing, limits, modalities, provider request shape, or lifecycle flags.
|
||||
当封装模型在实质上与源模型相同,仅因提供商特定的定价、限制、模态、提供商请求结构或生命周期标志而有所不同时,使用 `base_model`。
|
||||
|
||||
Sync and generator scripts should preserve existing `base_model` / `base_model_omit` fields when updating provider TOMLs. Do not use legacy `[extends]` tables.
|
||||
同步与生成脚本在更新提供商 TOML 时应保留现有的 `base_model` / `base_model_omit` 字段。请勿使用旧版 `[extends]` 表。
|
||||
|
||||
#### 4. Submit a Pull Request
|
||||
|
||||
1. Fork this repo
|
||||
2. Create a new branch with your changes
|
||||
3. Add your provider and/or model files
|
||||
4. Open a PR with a clear description
|
||||
1. Fork 本仓库
|
||||
2. 创建包含你更改的新分支
|
||||
3. 添加你的提供商和/或模型文件
|
||||
4. 提交 PR,并附上清晰的描述
|
||||
|
||||
### Validation
|
||||
### 验证
|
||||
|
||||
There's a GitHub Action that will automatically validate your submission against our schema to ensure:
|
||||
有一个 GitHub Action 会根据我们的 schema 自动验证你的提交,以确保:
|
||||
|
||||
- All required fields are present
|
||||
- Data types are correct
|
||||
- Values are within acceptable ranges
|
||||
- TOML syntax is valid
|
||||
- 所有必填字段都已存在
|
||||
- 数据类型正确
|
||||
- 值在可接受范围内
|
||||
- TOML 语法有效
|
||||
|
||||
When moving existing provider fields into model metadata, compare generated output before and after the change:
|
||||
将现有 provider 字段迁移到 model metadata 时,请在修改前后对比生成的输出:
|
||||
|
||||
```bash
|
||||
bun run compare:migrations
|
||||
```
|
||||
|
||||
This prints a diff for each changed model TOML so you can confirm the generated JSON only changed where you intended.
|
||||
这会为每个变更的 model TOML 打印 diff,以便你确认生成的 JSON 仅在你预期的位置发生变化。
|
||||
|
||||
### Schema Reference
|
||||
### Schema 参考
|
||||
|
||||
Models must conform to the following schema, as defined in `packages/core/src/schema.ts`.
|
||||
模型必须符合以下 schema,定义见 `packages/core/src/schema.ts`。
|
||||
|
||||
**Provider Schema:**
|
||||
**Provider Schema:**
|
||||
|
||||
- `name`: String - Display name of the provider
|
||||
- `npm`: String - AI SDK Package name
|
||||
- `env`: String[] - Environment variable keys used for auth
|
||||
- `doc`: String - Link to the provider's documentation
|
||||
- `api` _(optional)_: String - OpenAI-compatible API endpoint. Required only when using `@ai-sdk/openai-compatible` as the npm package
|
||||
- `name`: String - 提供商的显示名称
|
||||
- `npm`: String - AI SDK 包名
|
||||
- `env`: String[] - 用于身份验证的环境变量键名
|
||||
- `doc`: String - 提供商文档链接
|
||||
- `api` _(optional)_: String - 兼容 OpenAI 的 API 端点。仅在使用 `@ai-sdk/openai-compatible` 作为 npm 包时才需要
|
||||
|
||||
**Model Schema:**
|
||||
**Model Schema:**
|
||||
|
||||
- `name`: String — Display name of the model
|
||||
- `attachment`: Boolean — Supports file attachments
|
||||
- `reasoning`: Boolean — Supports reasoning / chain-of-thought
|
||||
- `tool_call`: Boolean - Supports tool calling
|
||||
- `structured_output` _(optional)_: Boolean — Supports structured output feature
|
||||
- `temperature` _(optional)_: Boolean — Supports temperature control
|
||||
- `knowledge` _(optional)_: String — Knowledge-cutoff date in `YYYY-MM` or `YYYY-MM-DD` format
|
||||
- `release_date`: String — First public release date in `YYYY-MM` or `YYYY-MM-DD`
|
||||
- `last_updated`: String — Most recent update date in `YYYY-MM` or `YYYY-MM-DD`
|
||||
- `open_weights`: Boolean - Indicate the model's trained weights are publicly available
|
||||
- `interleaved` _(optional)_: Boolean or Object — Supports interleaved reasoning. Use `true` for general support or an object with `field` to specify the format
|
||||
- `interleaved.field`: String — Name of the interleaved field (`"reasoning_content"` or `"reasoning_details"`)
|
||||
- `cost.input`: Number — Cost per million input tokens (USD)
|
||||
- `cost.output`: Number — Cost per million output tokens (USD)
|
||||
- `cost.reasoning` _(optional)_: Number — Cost per million reasoning tokens (USD)
|
||||
- `cost.cache_read` _(optional)_: Number — Cost per million cached read tokens (USD)
|
||||
- `cost.cache_write` _(optional)_: Number — Cost per million cached write tokens (USD)
|
||||
- `cost.input_audio` _(optional)_: Number — Cost per million audio input tokens, if billed separately (USD)
|
||||
- `cost.output_audio` _(optional)_: Number — Cost per million audio output tokens, if billed separately (USD)
|
||||
- `limit.context`: Number — Maximum context window (tokens)
|
||||
- `limit.input`: Number — Maximum input tokens
|
||||
- `limit.output`: Number — Maximum output tokens
|
||||
- `modalities.input`: Array of strings — Supported input modalities (e.g., ["text", "image", "audio", "video", "pdf"])
|
||||
- `modalities.output`: Array of strings — Supported output modalities (e.g., ["text"])
|
||||
- `status` _(optional)_: String — Supported status:
|
||||
- `alpha` - Indicate the model is in alpha testing
|
||||
- `beta` - Indicate the model is in beta testing
|
||||
- `deprecated` - Indicate the model is no longer served by the provider's public API
|
||||
- `name`: String — 模型的显示名称
|
||||
- `attachment`: Boolean — 是否支持文件附件
|
||||
- `reasoning`: Boolean — 是否支持推理 / chain-of-thought
|
||||
- `tool_call`: Boolean - 是否支持工具调用
|
||||
- `structured_output` _(optional)_: Boolean — 是否支持结构化输出
|
||||
- `temperature` _(optional)_: Boolean — 是否支持 temperature 控制
|
||||
- `knowledge` _(optional)_: String — 知识截止日期,格式为 `YYYY-MM` 或 `YYYY-MM-DD`
|
||||
- `release_date`: String — 首次公开发布日期,格式为 `YYYY-MM` 或 `YYYY-MM-DD`
|
||||
- `last_updated`: String — 最近更新日期,格式为 `YYYY-MM` 或 `YYYY-MM-DD`
|
||||
- `open_weights`: Boolean - 表示模型的训练权重是否公开可用
|
||||
- `interleaved` _(optional)_: Boolean or Object — 是否支持交错推理(interleaved reasoning)。使用 `true` 表示通用支持,或使用包含 `field` 的对象来指定格式
|
||||
- `interleaved.field`: String — 交错字段名称(`"reasoning_content"` 或 `"reasoning_details"`)
|
||||
- `cost.input`: Number — 每百万输入 token 的费用(USD)
|
||||
- `cost.output`: Number — 每百万输出 token 的费用(USD)
|
||||
- `cost.reasoning` _(optional)_: Number — 每百万推理 token 的费用(USD)
|
||||
- `cost.cache_read` _(optional)_: Number — 每百万缓存读取 token 的费用(USD)
|
||||
- `cost.cache_write` _(optional)_: Number — 每百万缓存写入 token 的费用(USD)
|
||||
- `cost.input_audio` _(optional)_: Number — 每百万音频输入 token 的费用(如单独计费)(USD)
|
||||
- `cost.output_audio` _(optional)_: Number — 每百万音频输出 token 的费用(如单独计费)(USD)
|
||||
- `limit.context`: Number — 最大上下文窗口(token 数)
|
||||
- `limit.input`: Number — 最大输入 token 数
|
||||
- `limit.output`: Number — 最大输出 token 数
|
||||
- `modalities.input`: Array of strings — 支持的输入模态(例如 ["text", "image", "audio", "video", "pdf"])
|
||||
- `modalities.output`: Array of strings — 支持的输出模态(例如 ["text"])
|
||||
- `status` _(optional)_: String — 支持状态:
|
||||
- `alpha` - 表示模型处于 alpha 测试阶段
|
||||
- `beta` - 表示模型处于 beta 测试阶段
|
||||
- `deprecated` - 表示模型已不再通过提供商的公开 API 提供服务
|
||||
|
||||
### Examples
|
||||
### 示例
|
||||
|
||||
See existing providers in the `providers/` directory for reference:
|
||||
请参阅 `providers/` 目录中的现有提供商作为参考:
|
||||
|
||||
- `providers/anthropic/` - Anthropic Claude models
|
||||
- `providers/openai/` - OpenAI GPT models
|
||||
- `providers/google/` - Google Gemini models
|
||||
- `providers/anthropic/` - Anthropic Claude 模型
|
||||
- `providers/openai/` - OpenAI GPT 模型
|
||||
- `providers/google/` - Google Gemini 模型
|
||||
|
||||
### Working on frontend
|
||||
### 前端开发
|
||||
|
||||
Make sure you have [Bun](https://bun.sh/) installed.
|
||||
请确保已安装 [Bun](https://bun.sh/)。
|
||||
|
||||
```bash
|
||||
$ bun install
|
||||
@@ -307,11 +313,11 @@ $ cd packages/web
|
||||
$ bun run dev
|
||||
```
|
||||
|
||||
And it'll open the frontend at http://localhost:3000
|
||||
前端将在 http://localhost:3000 打开。
|
||||
|
||||
### Manual testing with opencode
|
||||
### 使用 opencode 进行手动测试
|
||||
|
||||
You can manually check provider changes with opencode by:
|
||||
你可以通过 opencode 手动检查 provider 变更:
|
||||
|
||||
```bash
|
||||
$ bun install
|
||||
@@ -320,12 +326,12 @@ $ bun run build
|
||||
$ OPENCODE_MODELS_PATH="dist/_api.json" opencode
|
||||
```
|
||||
|
||||
### Questions?
|
||||
### 有问题?
|
||||
|
||||
Open an issue if you need help or have questions about contributing.
|
||||
如需帮助或对贡献有疑问,请提交 issue。
|
||||
|
||||
---
|
||||
|
||||
Models.dev is created by the maintainers of [SST](https://sst.dev).
|
||||
Models.dev 由 [SST](https://sst.dev). 维护者创建。
|
||||
|
||||
**Join our community** [Discord](https://sst.dev/discord) | [YouTube](https://www.youtube.com/c/sst-dev) | [X.com](https://x.com/SST_dev)
|
||||
**加入我们的社区** [Discord](https://sst.dev/discord) | [YouTube](https://www.youtube.com/c/sst-dev) | [X.com](https://x.com/SST_dev)
|
||||
|
||||
Reference in New Issue
Block a user