Langsung ke konten utama

Parameter Path

model
string
wajib
ID model yang ingin diambil (misalnya: gpt-5.4, claude-sonnet-4-6).

Respons

id
string
Identitas model. Ini juga menyertakan lifecycle, commercial, dan badges untuk status depresiasi/pensiun, kebijakan biaya, dan badge tampilan.
object
string
Selalu model.
created
integer
Timestamp pembuatan.
owned_by
string
Provider model.
tokenlab
object
Metadata publik khusus TokenLab. Route detail dapat mencakup category, pricing_unit, capability_flags, supported_operations, pricing_provenance, request_format_summary, request_format_details lengkap, dan agent_preferences level scene untuk snapshot rekomendasi non-chat.
curl "https://api.tokenlab.sh/v1/models/gpt-5.4" \
  -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"
)

model = client.models.retrieve("gpt-5.4")
print(f"Model: {model.id}, Provider: {model.owned_by}")
import OpenAI from 'openai';

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

const model = await client.models.retrieve('gpt-5.4');
console.log(`Model: ${model.id}, Provider: ${model.owned_by}`);
package main

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

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

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

    var model map[string]interface{}
    json.NewDecoder(resp.Body).Decode(&model)
    fmt.Printf("Model: %s, Provider: %s\n", model["id"], model["owned_by"])
}
<?php
$ch = curl_init('https://api.tokenlab.sh/v1/models/gpt-5.4');

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

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

$model = json_decode($response, true);
echo "Model: {$model['id']}, Provider: {$model['owned_by']}\n";
{
  "id": "gpt-5.4",
  "object": "model",
  "created": 1706000000,
  "owned_by": "openai"
}

Penanganan Error

Jika model tidak ada, Anda akan menerima error 404:
{
  "error": {
    "message": "Model 'invalid-model' not found",
    "type": "invalid_request_error",
    "code": "model_not_found"
  }
}

Metadata Rekomendasi Non-Chat

Untuk model non-chat, route detail juga mengembalikan tokenlab.agent_preferences.<scene>. Gunakan untuk melihat:
  • preferred_rank
  • success_rate_24h
  • sample_count_24h
  • status
  • updated_at
Respons publik merangkum asal rekomendasi dengan basis.source dan tidak mengekspos identifier routing.

Metadata Detail Publik

Dibandingkan GET /v1/models, route detail juga bisa mengembalikan:
  • tokenlab.capability_flags
  • tokenlab.supported_operations
  • tokenlab.pricing_provenance
  • tokenlab.request_format_summary
  • tokenlab.request_format_details

Penghapusan Model

DELETE /v1/models/{model} tidak didukung. Model TokenLab adalah katalog publik bersama, bukan resource model fine-tuned milik pengguna.