Chuyển đến nội dung chính

Phản hồi

object
string
Luôn là list.
data
array
Mảng các object model.Mỗi model luôn chứa:
  • id (string): Định danh model
  • object (string): model
  • created (integer): Dấu thời gian tạo
  • owned_by (string): Nhà cung cấp model
  • tokenlab.aliases (array): Alias công khai cho cùng model
  • tokenlab.pricing (object): Tóm tắt giá công khai dạng đơn giản
  • tokenlab.capabilities (array): Tag năng lực công khai
  • tokenlab.max_input_tokens (number hoặc null): Giới hạn ngữ cảnh input khi có
  • tokenlab.max_output_tokens (number hoặc null): Giới hạn output khi có
  • tokenlab.category (string): Danh mục công khai của model
  • tokenlab.pricing_unit (string): Đơn vị giá công khai
  • tokenlab.has_complex_pricing (boolean): Giá có chiều riêng theo model hay không
  • tokenlab.lifecycle (object): giai đoạn vòng đời, ngày phát hành/deprecation, model thay thế và nguồn badge latest
  • tokenlab.commercial (object): chính sách tính phí người dùng, lý do miễn phí và thời điểm hết miễn phí tùy chọn
  • tokenlab.badges (array): badge hiển thị từ metadata vòng đời và thương mại
Metadata danh sách có điều kiện:
  • tokenlab.providers (array): Nhà cung cấp công khai khi có
  • tokenlab.cache_pricing (object hoặc null): Giá prompt cache khi có
  • tokenlab.pricing_summary (object hoặc null): Chỉ trả về cho model có giá phức tạp
  • tokenlab.request_format_summary (object hoặc null): Tóm tắt khám phá phi-chat nhẹ, gồm public_operations, request_endpoint, và request_endpoint_by_operation
  • tokenlab.agent_preferences (object): Chỉ trả về khi có recommended_for
Các field chỉ có ở trang chi tiết như tokenlab.capability_flags, tokenlab.supported_operations, tokenlab.pricing_provenance, và tokenlab.request_format_details chỉ được trả về bởi GET /v1/models/{model}.
GET /v1/models được tối ưu cho khám phá. Metadata chỉ có ở trang chi tiết như capability_flags, pricing_provenance, và request_format_details đầy đủ nằm ở GET /v1/models/{model}.

Tham số Query

category
string
Bộ lọc danh mục công khai tùy chọn. Hỗ trợ chat, image, video, audio, tts, stt, music, 3d, embedding, rerank, và translation.
Kịch bản khuyến nghị phi-chat tùy chọn. Hỗ trợ image, video, music, 3d, tts, stt, embedding, rerank, và translation.
provider
string
Bộ lọc nhà cung cấp tùy chọn như openai, anthropic, google, hoặc deepseek.
tag
string
Bộ lọc tag model tùy chọn như chat, image, video, embedding, hoặc translation.
Khi có recommended_for, /v1/models sắp xếp model phi-chat theo snapshot tỷ lệ thành công 24 giờ đã cache mới nhất. Model có status = "insufficient_samples" vẫn hiển thị nhưng xếp sau các model đã có điểm.
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"
    }
  ]
}

Lọc theo Nhà Cung Cấp

# 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"]

Danh Mục Model

Nhà cung cấpModel ví dụ
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

Ví dụ Khuyến nghị Agent

Response
{
  "object": "list",
  "data": [
    {
      "id": "gemini-2.5-flash-image",
      "object": "model",
      "created": 1706000000,
      "owned_by": "google",
      "tokenlab": {
        "category": "image",
        "pricing_unit": "per_request",
        "agent_preferences": {
          "image": {
            "preferred_rank": 1,
            "success_rate_24h": 0.98,
            "sample_count_24h": 423,
            "status": "ready",
            "updated_at": "2026-03-28T12:00:00.000Z",
            "basis": {
              "source": "recent_activity_24h"
            }
          }
        }
      }
    }
  ]
}

Xóa model

DELETE /v1/models/{model} không được hỗ trợ. Model TokenLab là catalog công khai dùng chung, không phải tài nguyên model fine-tuned do người dùng sở hữu.