跳转到主要内容

响应

object
string
始终为 list
data
array
模型对象数组。每个模型始终包含:
  • id (string): 模型标识符
  • object (string): model
  • created (integer): 创建时间戳
  • owned_by (string): 模型提供方
  • tokenlab.aliases (array): 同一模型的公开别名
  • tokenlab.pricing (object): 公开基础价格摘要
  • tokenlab.capabilities (array): 公开能力标签
  • tokenlab.max_input_tokens (number or null): 可用时的输入上下文上限
  • tokenlab.max_output_tokens (number or null): 可用时的输出上限
  • tokenlab.category (string): 公开模型分类
  • tokenlab.pricing_unit (string): 公开定价单位
  • tokenlab.has_complex_pricing (boolean): 价格是否有模型专属维度
  • tokenlab.lifecycle(object):生命周期状态、发布日期/弃用日期、替代模型和 latest 标签来源
  • tokenlab.commercial(object):用户收费策略、免费原因和可选免费截止时间
  • tokenlab.badges(array):由生命周期和商业策略派生的展示标签
条件式列表元数据:
  • tokenlab.providers (array): 可用时的公开提供方
  • tokenlab.cache_pricing (object or null): 可用时的 prompt cache 价格
  • tokenlab.pricing_summary (object or null): 仅在复杂价格模型上返回
  • tokenlab.request_format_summary (object or null): 轻量级非聊天发现摘要,包含 public_operationsrequest_endpointrequest_endpoint_by_operation
  • tokenlab.agent_preferences (object): 仅在存在 recommended_for 时返回
tokenlab.capability_flagstokenlab.supported_operationstokenlab.pricing_provenancetokenlab.request_format_details 等仅详情可见的字段,只会由 GET /v1/models/{model} 返回。
GET /v1/models 侧重于发现。像 capability_flagspricing_provenance 和完整的 request_format_details 这类仅详情可见的元数据都在 GET /v1/models/{model} 中。

查询参数

category
string
可选的公开分类筛选。支持 chatimagevideoaudiottssttmusic3dembeddingreranktranslation
可选的非聊天推荐场景。支持 imagevideomusic3dttssttembeddingreranktranslation
provider
string
可选的提供方筛选,例如 openaianthropicgoogledeepseek
tag
string
可选的模型标签筛选,例如 chatimagevideoembeddingtranslation
recommended_for 存在时,/v1/models 会按照最近缓存的 24 小时成功率快照对非聊天模型排序。status = "insufficient_samples" 的模型仍会显示,但会排在已有评分的模型之后。
curl "https://api.tokenlab.sh/v1/models" \
  -H "Authorization: Bearer sk-your-api-key"
from openai import OpenAI

client = OpenAI(
    api_key="sk-your-api-key",
    base_url="https://api.tokenlab.sh/v1"
)

models = client.models.list()

for model in models.data:
    print(f"{model.id} ({model.owned_by})")
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: 'sk-your-api-key',
  baseURL: 'https://api.tokenlab.sh/v1'
});

const models = await client.models.list();

for (const model of models.data) {
  console.log(`${model.id} (${model.owned_by})`);
}
package main

import (
    "encoding/json"
    "fmt"
    "net/http"
)

func main() {
    req, _ := http.NewRequest("GET", "https://api.tokenlab.sh/v1/models", nil)
    req.Header.Set("Authorization", "Bearer sk-your-api-key")

    resp, _ := http.DefaultClient.Do(req)
    defer resp.Body.Close()

    var payload struct {
        Data []struct {
            ID      string `json:"id"`
            OwnedBy string `json:"owned_by"`
        } `json:"data"`
    }

    json.NewDecoder(resp.Body).Decode(&payload)

    for _, model := range payload.Data {
        fmt.Printf("%s (%s)\n", model.ID, model.OwnedBy)
    }
}
<?php
$ch = curl_init('https://api.tokenlab.sh/v1/models');

curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer sk-your-api-key'
    ]
]);

$response = curl_exec($ch);
curl_close($ch);

$data = json_decode($response, true);
foreach ($data['data'] as $model) {
    echo "{$model['id']} ({$model['owned_by']})\n";
}
{
  "object": "list",
  "data": [
    {
      "id": "gpt-5.4",
      "object": "model",
      "created": 1706000000,
      "owned_by": "openai"
    },
    {
      "id": "claude-sonnet-4-6",
      "object": "model",
      "created": 1706000000,
      "owned_by": "anthropic"
    },
    {
      "id": "gemini-3.5-flash",
      "object": "model",
      "created": 1706000000,
      "owned_by": "google"
    }
  ]
}

按提供方筛选

# Get all OpenAI models
openai_models = [m for m in models.data if m.owned_by == "openai"]

# Get all Anthropic models
anthropic_models = [m for m in models.data if m.owned_by == "anthropic"]

模型类别

提供方示例模型
openaigpt-5.4, gpt-5.4-mini, gpt-5-mini, gpt-4o, gpt-image-2
anthropicclaude-opus-4-6, claude-sonnet-4-6, claude-haiku-4-5
googlegemini-3.1-pro-preview, gemini-3.5-flash, gemini-2.5-pro
deepseekdeepseek-r1, deepseek-v3-2
xaigrok-4.1
moonshotkimi-k2.5
minimaxminimax-m3
metallama-3.3-70b, llama-3.1-405b

模型删除

DELETE /v1/models/{model} 不受支持。TokenLab 模型是共享公开目录,不是用户拥有的微调模型资源。