TokenLab

核心

列出模型

列出目前 TokenLab 上可用的模型

GET
/v1/models

模型目錄是公開的,不需要 API key。每個項目都包含當前功能、價格和 API 格式的摘要。當您需要完整詳細資訊時,請檢索單一模型。

當您提供 API key 時,TokenLab 會對其進行驗證,並根據該 key 的模型權限和有效交付政策篩選目錄。設定為 verified 的 key 會列出具有 TokenLab Verified 供應的模型;official 則列出具有 Official 供應的模型。當 key 或交付政策變更時,請重新整理您的模型選擇器。請求中支援的交付覆寫優先於 key 和工作區的預設設定。

查詢參數

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
  • tokenlab.agent_preferences(當使用 recommended_for 時)

當使用 recommended_for 時,結果可能還包含建議狀態和更新時間。請讀取當前回應,而非固定順序。

錯誤

狀態代碼原因
400invalid_view, invalid_provider, invalid_category, invalid_recommended_for查詢值不被接受。訊息中會列出有效值。當同時設定 category 和 recommended_for 時,兩者必須相符
401invalid_api_key您傳送的 API key 無效。請移除標頭以讀取公開列表
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 金鑰。

位置: 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