模型发现与目录
公开的模型 + 价格查询接口,以及按组织授权的实时定价查询。
无界模型云提供两个接口用于发现可用模型与查询价格:
- 公开模型 + 价格批量查询:无需鉴权,CDN 缓存友好,适合官网 / 价目页等展示场景。
- 组织维度实时定价:需要网关 API Key,按 Key 所属组织作用域返回该组织的有效价格目录。
具体的模型 ID、可用范围与单价会随控制台更新。建议把模型 ID 作为配置项管理,跟随控制台更新切换版本,不要硬编码到代码逻辑里。
公开模型 + 价格批量查询
按一批模型 ID 批量查询模型元信息与对应币种价格。无需鉴权,返回带 CORS 与缓存头,适合营销站点 / 价目页直接调用。
POST https://ai.tos.run/v1/public/models/lookup?currency=CNYcurrency查询参数必填,为 3 位 ISO 4217 币种码(如USD、CNY)。缺失或格式非法返回400。- body 为
{"modelIds": [...]},最多 200 个 id;超过 200 返回413。 - 无需
Authorization头。
该接口在 master host https://ai.tos.run 上提供(数据面 api.tos.run 不代理此公开端点)。它查询的是静态公开目录:-x 这类「latest」别名与按 DB 注册的 id(如 gpt-image-2)不在静态目录中,查询会返回 null——但它们在实际调用时可正常路由出图 / 对话。
请求
curl "https://ai.tos.run/v1/public/models/lookup?currency=CNY" \
-H "Content-Type: application/json" \
-d '{
"modelIds": ["qwen-turbo", "qwen-max", "non-existent-id"]
}'import requests
resp = requests.post(
"https://ai.tos.run/v1/public/models/lookup",
params={"currency": "CNY"},
json={"modelIds": ["qwen-turbo", "qwen-max", "non-existent-id"]},
)
print(resp.json())const resp = await fetch(
"https://ai.tos.run/v1/public/models/lookup?currency=CNY",
{
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
modelIds: ["qwen-turbo", "qwen-max", "non-existent-id"],
}),
},
);
console.log(await resp.json());响应
返回结构为 { models, currency, asOf }。models 是一个以请求里的 model ID 为键的映射:命中返回模型条目,未命中返回 null。
{
"models": {
"qwen-turbo": {
"id": "qwen-turbo",
"label": "通义千问 Turbo",
"labelEn": "Qwen Turbo",
"labelZh": "通义千问 Turbo",
"providerId": "dashscope",
"providerLabel": "阿里云百炼",
"capabilityId": "llm",
"contextWindow": 1000000,
"supportsVision": false,
"pricing": {
"currency": "CNY",
"inputPerMillionTokens": "0.3",
"outputPerMillionTokens": "0.6",
"cachedInputPerMillionTokens": null,
"lastChangedAt": "2026-05-13T09:58:35.973Z"
}
},
"qwen-max": {
"id": "qwen-max",
"label": "通义千问 Max",
"labelEn": "Qwen Max",
"labelZh": "通义千问 Max",
"providerId": "dashscope",
"providerLabel": "阿里云百炼",
"capabilityId": "llm",
"contextWindow": 32768,
"supportsVision": false,
"pricing": {
"currency": "CNY",
"inputPerMillionTokens": "2.4",
"outputPerMillionTokens": "9.6",
"cachedInputPerMillionTokens": null,
"lastChangedAt": "2026-05-13T09:58:35.973Z"
}
},
"non-existent-id": null
},
"currency": "CNY",
"asOf": "2026-06-16T02:10:24.193Z"
}模型条目字段:
| 字段 | 说明 |
|---|---|
id | 模型 ID |
label | 展示名(跟随请求 / 站点语言) |
labelEn | 英文展示名(始终返回) |
labelZh | 中文展示名(始终返回) |
providerId | 号源 / 供应商 ID(如 dashscope、openai、anthropic) |
providerLabel | 号源展示名 |
capabilityId | 能力 ID(llm / image / asr / tts / ocr / vision-segment) |
contextWindow | 上下文窗口(token 数,可能为 null) |
supportsVision | 是否支持视觉输入 |
pricing | 该币种下的价格:currency、inputPerMillionTokens、outputPerMillionTokens、cachedInputPerMillionTokens(无显式缓存价时为 null)、lastChangedAt(单位为「每 1M token」) |
该接口的「展示哪些模型」由调用方(站点)自行决定——你把要展示的 model ID 列表传进来,接口只负责解析元信息与对应币种的价格。未知 ID 返回 null,便于过滤。
组织维度实时定价
按当前网关 API Key 所属组织,查询该组织的有效价格目录(系统价 + 组织专属覆盖合并后的结果)。需要鉴权,作用域是 Key 所属的 org。
GET https://ai.tos.run/v1/pricing/lookup?capability=llm&provider=anthropic&model=claude-sonnet-4-x- 该端点在 master host
https://ai.tos.run上提供(数据面api.tos.run不代理此控制面端点)。 - 鉴权头
Authorization: Bearer gk_...,按 Key 所属组织作用域。 - 查询参数
capability、provider、model用于筛选(可按需组合)。 - 返回
{ currency, entries, version }。
curl "https://ai.tos.run/v1/pricing/lookup?capability=llm&provider=anthropic&model=claude-sonnet-4-x" \
-H "Authorization: Bearer $TOS_API_KEY"import os, requests
resp = requests.get(
"https://ai.tos.run/v1/pricing/lookup",
params={
"capability": "llm",
"provider": "anthropic",
"model": "claude-sonnet-4-x",
},
headers={"Authorization": f"Bearer {os.environ['TOS_API_KEY']}"},
)
print(resp.json())const url = new URL("https://ai.tos.run/v1/pricing/lookup");
url.search = new URLSearchParams({
capability: "llm",
provider: "anthropic",
model: "claude-sonnet-4-x",
}).toString();
const resp = await fetch(url, {
headers: { Authorization: `Bearer ${process.env.TOS_API_KEY}` },
});
console.log(await resp.json());返回的 entries 是该组织有效目录里命中筛选条件的价格条目,currency 为组织计费币种,version 标识目录版本。
外国前沿 LLM 默认对未授权组织隐藏。Anthropic / OpenAI / Gemini 等前沿品牌只有在组织被显式授权后,才会出现在该组织的目录里——「看得到」与「调得动」保持一致。如果某个模型没出现在 /v1/pricing/lookup 结果中,通常是该组织尚未被授权该模型。
两个接口怎么选
| 场景 | 用哪个 |
|---|---|
| 官网 / 价目页展示一批模型与价格(无登录态、需缓存、跨域) | 公开 POST https://ai.tos.run/v1/public/models/lookup |
| 在自己组织内确认实时有效价格(含组织专属覆盖、授权范围) | 鉴权 GET https://ai.tos.run/v1/pricing/lookup |
实际单价、可用模型与折扣以控制台 / 组织价格为准。组织专属价格、合同折扣与控制台实时价格优先级更高。把模型 ID 作为配置项管理,跟随控制台更新平滑切换版本。