型号列表GET
列出当前密钥可调用的全部型号,以及每个型号已验收的接口、响应方式、输入类型、输出上限与官方价格表。
GET https://api.tokentosea.com/v1/models
返回当前密钥可以调用的型号。这是判断「某个型号能否用某个接口、能否流式、能否传图片」的权威来源:网关拒绝列表之外的任何组合。
列表按密钥过滤:密钥限定了型号或服务商时,只返回范围内的型号。未上线、已下线或价格版本与执行节点不一致的型号不会出现。
前提:全能密钥或模型密钥。查询不产生费用。
两个不同的 models 接口
https://api.tokentosea.com/v1/models(本页)返回官方型号目录,使用全能密钥或模型密钥。https://tokentosea.com/api/v1/models 是历史接口,只为订单专用密钥列出已购模型,两者不要混用。
请求#
| 请求头 | 必填 | 说明 |
|---|---|---|
Authorization / x-api-key | 必填 | 全能密钥或模型密钥 |
没有请求参数。
curl https://api.tokentosea.com/v1/models \
-H "Authorization: Bearer $TOKENTOSEA_API_KEY"import os
import requests
response = requests.get(
"https://api.tokentosea.com/v1/models",
headers={"Authorization": "Bearer " + os.environ["TOKENTOSEA_API_KEY"]},
timeout=30,
)
response.raise_for_status()
models = response.json()["data"]
# 找出可以流式调用 Chat Completions 并接受图片输入的型号
for model in models:
path = "/v1/chat/completions"
modes = (model.get("response_modes") or {}).get(path) or {}
inputs = ((model.get("verified_inputs") or {}).get(path) or {}).get("sse", [])
if modes.get("sse") and "image" in inputs:
print(model["id"], model["owned_by"], model["max_output_tokens"])const response = await fetch('https://api.tokentosea.com/v1/models', {
headers: { Authorization: `Bearer ${process.env.TOKENTOSEA_API_KEY}` },
});
if (!response.ok) throw new Error(`HTTP ${response.status}: ${await response.text()}`);
const { data } = await response.json();
// 找出支持视频生成的型号
const videoModels = data.filter((m) => (m.verified_endpoints ?? []).includes('/v1/videos'));
console.log(videoModels.map((m) => `${m.id} (${m.owned_by})`).join('\n'));使用 OpenAI SDK 时,client.models.list() 同样可用;SDK 会保留下表中的扩展字段。
响应#
响应示例(节选)
{
"object": "list",
"data": [
{
"id": "glm-5.3",
"object": "model",
"owned_by": "zhipu",
"region": "cn",
"modality": "chat",
"protocols": ["openai-chat", "anthropic-messages", "openai-responses"],
"verified_endpoints": ["/v1/chat/completions", "/v1/messages", "/v1/responses"],
"response_modes": {
"/v1/chat/completions": { "json": true, "sse": true },
"/v1/messages": { "json": true, "sse": true },
"/v1/responses": { "json": true, "sse": true }
},
"input_modalities": ["text"],
"verified_inputs": {
"/v1/chat/completions": { "json": ["text"], "sse": ["text"] }
},
"status": "active",
"max_output_tokens": 131072,
"price_version": "official-cn-full-20261019-b151fc538e90",
"currency": "CNY",
"pricing_status": "official",
"tariff": {
"version": 2,
"currency": "CNY",
"checkedAt": "2026-10-19",
"sourceUrls": ["https://docs.bigmodel.cn/cn/guide/start/pricing"],
"rules": [
{
"id": "standard",
"when": { "service_tier": "standard" },
"components": [
{ "metric": "input_tokens", "rate": "8", "per": "1000000", "label": "输入 token" },
{ "metric": "output_tokens", "rate": "28", "per": "1000000", "label": "输出 token" },
{ "metric": "cached_input_tokens", "rate": "2", "per": "1000000", "label": "缓存命中 token" }
]
}
]
},
"official_tariff": { "…": "与 tariff 相同" }
}
]
}型号对象#
| 字段 | 类型 | 说明 |
|---|---|---|
id | string | 型号 ID。调用时原样填入请求体的 model |
object | string | 固定为 model |
owned_by | string | 服务商:qwen、zhipu、minimax、doubao、stepfun、kimi、deepseek、typesafe、cloudflare |
region | string | 执行区域:cn(国内)或 global(海外) |
modality | string | 类别:chat、image、video、speech、asr、realtime、embedding、rerank、tool、3d、system_one |
protocols | string[] | 已验收的协议,目前的取值有 openai-chat、openai-responses、anthropic-messages、native-realtime、native-task、native-asr、native-speech、system-one。今后可能增加新值,请忽略不认识的值 |
verified_endpoints | string[] | 可调用的推理接口路径。不在列表中的路径返回 422 endpoint_not_verified |
resource_endpoints | string[] | 可使用的资源接口,例如 /v1/files、/v1/audio/voices、/v1/files/:id/content |
response_modes | object | 每个接口是否支持 JSON(json)和 SSE(sse)响应。不支持的方式返回 422 response_mode_not_verified |
input_modalities | string[] | 型号整体接受的输入类型:text、image、audio、video、document |
verified_inputs | object | 每个接口、每种响应方式下已验收的输入类型。对话类型号传入未列出的类型(例如图片)返回 422 input_modality_not_verified |
system_voices | string[] | 语音类型号可直接使用的系统音色 ID |
input_limits | object | 部分型号的输入上限,例如 System One 的 request_bytes、image_bytes、context_tokens,批量向量的 file_bytes、lines、line_utf8_bytes |
capability_category | string | 仅 System One 型号:System One |
experimental_capabilities | string[] | 仅 System One 型号:官方标为实验能力的部分,例如 image、box |
status | string | active 正常;snapshot 带日期的固定版本;retiring 上游已公布下线计划,请尽快迁移 |
max_output_tokens | number | 允许的最大输出上限。请求中的输出上限超过它返回 400 |
price_version | string | 当前价格版本。价格变更时更新 |
currency | string | 官方价格的原币种:CNY 或 USD |
pricing_status | string | official 为厂商公布的官方价;provisional 为厂商尚未公布价格时,按同类型号最高价执行的暂定价 |
pricing_basis | object | 仅暂定价出现:参照型号与比较范围 |
tariff | object | 价格表,见下文 |
official_tariff | object | null | 官方价时与 tariff 相同;暂定价时为 null |
价格表#
tariff 以原币种描述官方价格:
| 字段 | 说明 |
|---|---|
currency | CNY 或 USD |
checkedAt | 平台核对官方价格的日期 |
sourceUrls | 官方价格页地址 |
rules[] | 计价规则。每条规则有 when(适用条件,例如 service_tier、input_length、resolution、thinking、cache_mode)和 components(计量项) |
rules[].components[] | metric 计量项(如 input_tokens、output_tokens、cached_input_tokens、output_seconds、images、characters),rate 单价(十进制字符串),per 计价单位数量(例如 1000000 表示每百万),label 中文名称 |
maxUsage | 单次调用各计量项的预留上限 |
inputTokenLimit | 部分型号的输入 token 上限 |
一次调用只会匹配一条规则:预留时取所有可能规则中的最高价,结算时按实际用量和请求条件选定唯一规则。人民币价格按调用时冻结的汇率快照折算成美元,从账户余额扣除,保留 6 位小数并向上取整。完整说明见计费与余额;每个型号的价格表也展示在其模型页面。
错误#
| 状态码 | code | 原因 |
|---|---|---|
401 | invalid_api_key | 未携带密钥,或密钥格式错误 |
401 | model_directory_unavailable | 密钥无效、已撤销、已删除或已过期 |
503 | model_directory_unavailable | 目录暂时不可用,或密钥不能调用官方型号(例如订单专用密钥) |
下一步#
- 模型目录:每个型号的介绍、价格、调用示例
- Chat Completions:最常用的对话接口
- API 概览:鉴权、幂等与错误约定