核心

列出模型

列出当前可用模型

GET
/v1/models

模型目录是公开接口,不需要 API 密钥。每个模型都带有当前能力、价格和 API 格式摘要;需要完整信息时,再查询单个模型。

提供 API 密钥时,TokenLab 会校验密钥,并按密钥的模型权限和有效交付策略筛选目录。设为 verified 的密钥只列出支持 TokenLab Verified 的模型;设为 official 时只列出支持 Official 的模型。切换密钥或交付策略后,应重新加载模型选择列表。请求中受支持的交付策略覆盖优先于密钥和工作区默认值。

查询参数

categorystringquery

按类别筛选:chat、image、video、audio、tts、stt、music、3d、embedding、rerank、decision 或 translation。

recommended_forstringquery

获取某类任务的当前推荐模型,例如 image、video、music、3d、tts、stt、embedding、rerank、decision 或 translation。

providerstringquery

按模型厂商筛选,例如 openai、anthropic、google 或 deepseek。

tagstringquery

按能力标签筛选,例如 reasoning、tool-use、vision 或 text-to-image。tokenlab.capabilities 中的值都是有效标签。按模型类型筛选请用 category。

viewstringquery默认值: full

full 返回下文所述的完整列表。compact 返回更小的选型列表:id、provider、category、capabilities、token 上限、价格摘要、status、deliveryAvailability、supported_operations 和 request_endpoint,顶层另有 view 和 count。

响应

objectstring

固定为 list。

dataarray

模型列表。每项包含 id、owned_by 和 tokenlab 摘要。

tokenlab 中常用的列表字段包括:

  • tokenlab.aliases:公开别名。
  • tokenlab.capabilities:模型能力。
  • tokenlab.deliveryAvailability:若提供,分别说明是否支持 verified 和 official;字段缺失表示未知,支持不代表实时可用保证。
  • tokenlab.pricing:Verified 价格。tokenlab.deliveryAvailability.verified 为 false 时其中的价格字段为 null,这类模型按 Official 价格计费。
  • tokenlab.official_pricing:Official 价格。由 Official 交付的请求按此价格计费。
  • tokenlab.pricing_unit:计费单位。
  • tokenlab.max_input_tokens 与 tokenlab.max_output_tokens:上下文和输出上限。
  • tokenlab.category:模型类别。
  • tokenlab.lifecycle、tokenlab.commercial 与 tokenlab.badges:当前状态、收费方式和页面标签。
  • tokenlab.request_format_summary:适用的 API 地址和操作。
  • tokenlab.agent_preferences:使用 recommended_for 时返回的推荐信息。

使用 recommended_for 时,响应还可能包含推荐状态和更新时间。推荐顺序会变化,请在使用时读取最新结果。

错误

状态码代码原因
400invalid_view、invalid_provider、invalid_category、invalid_recommended_for查询参数的值不被接受,消息会列出有效值。同时设置 category 和 recommended_for 时二者必须一致
401invalid_api_key你发送的 API 密钥无效。去掉该请求头即可读取公开列表
429rate_limit_exceeded对公开目录的请求过于频繁。请缓存响应,并在 Retry-After 之后重试

示例

curl "https://api.tokenlab.sh/v1/models?category=video"
{
  "object": "list",
  "data": [
    {
      "id": "veo3.1",
      "object": "model",
      "owned_by": "google",
      "tokenlab": {
        "category": "video",
        "capabilities": ["text-to-video", "image-to-video"]
      }
    }
  ]
}

单个模型的完整字段见获取模型。

curl -X GET "https://example.com/v1/models"
{  "object": "list",  "data": [    {      "id": "string",      "object": "model",      "created": 0,      "owned_by": "string",      "tokenlab": {        "aliases": [          "string"        ],        "deliveryAvailability": {          "verified": true,          "official": true,          "operations": {            "property1": {              "verified": true,              "official": true            },            "property2": {              "verified": true,              "official": true            }          }        },        "pricing": {          "input_per_1m": "string",          "output_per_1m": "string",          "per_request": "string",          "is_lock_price": true,          "currency": "USD"        },        "official_pricing": {          "input_per_1m": "string",          "output_per_1m": "string",          "per_request": "string",          "is_lock_price": true,          "currency": "USD"        },        "capabilities": [          "string"        ],        "providers": [          "string"        ],        "max_input_tokens": 0,        "max_output_tokens": 0,        "category": "string",        "pricing_unit": "string",        "cache_pricing": {},        "official_cache_pricing": {},        "has_complex_pricing": true,        "pricing_summary": {},        "agent_preferences": {},        "lifecycle": {          "stage": "active",          "reason": "string",          "replacement_model": "string",          "released_at": "2019-08-24T14:15:22Z",          "deprecated_at": "2019-08-24T14:15:22Z",          "retired_at": "2019-08-24T14:15:22Z",          "sunset_at": "2019-08-24T14:15:22Z",          "latest": true,          "latest_source": "auto",          "latest_window_days": 0        },        "commercial": {          "user_charge_policy": "paid",          "free_reason": "platform",          "free_until": "2019-08-24T14:15:22Z"        },        "badges": [          {            "key": "free",            "tone": "green",            "priority": 0,            "tooltip": {              "key": "string",              "values": {                "property1": "string",                "property2": "string"              }            }          }        ],        "request_format_summary": {          "public_operations": [            "string"          ],          "request_endpoint": "string",          "request_endpoint_by_operation": {            "property1": "string",            "property2": "string"          }        }      }    }  ]}

授权

BearerAuth
AuthorizationBearer <token>

API Key 身份验证。在 Dashboard > API > API Keys 中创建或管理 API Key。

位置: header

查询参数

provider?string

按公共模型提供商过滤,例如 openai、anthropic、google 或 minimax。

tag?string

按能力标签过滤,例如 reasoning、tool-use、vision 或 text-to-image。模型 tokenlab.capabilities 中的值均为有效标签。若要按模型种类过滤,请使用 category。

category?string

按模型类别过滤。

可选值

  • "chat"
  • "embedding"
  • "translation"
  • "image"
  • "video"
  • "audio"
  • "tts"
  • "stt"
  • "rerank"
  • "3d"
  • "music"
  • "decision"
recommended_for?string

为任务类别排序支持的非聊天模型,并包含推荐依据。

可选值

  • "image"
  • "video"
  • "music"
  • "3d"
  • "tts"
  • "stt"
  • "embedding"
  • "rerank"
  • "translation"
  • "decision"
view?string

选择紧凑的模型选择字段或完整的兼容 OpenAI 的列表格式。

默认值"full"

可选值

  • "compact"
  • "full"

响应

application/json

application/json

application/json

application/json

application/json