Models

Một API duy nhất cho hàng trăm model

Trạm AI cung cấp quyền truy cập hơn 300 model AI từ nhiều provider khác nhau thông qua một API duy nhất.

Để duyệt, so sánh và lọc model theo khả năng, giá cả, tốc độ và nhiều tiêu chí khác, hãy truy cập trang danh sách Models.

Models API (/v1/models)

Tương thích với OpenAI Models API. Trả về danh sách các model hiện có.

lines
$curl "https://api.tramlabs.io/v1/models" \
> -H "Authorization: Bearer $TRAM_AI_API_KEY"

Response

lines
1{
2 "data": [
3 {
4 "id": "gemini-3.5-flash",
5 "object": "model",
6 "created": 1719900000,
7 "owned_by": "google",
8 "mode": "chat"
9 }
10 ],
11 "object": "list"
12}

Public Models API (/public/models)

Endpoint công khai (không cần xác thực) cung cấp thông tin chi tiết về tất cả các model, bao gồm giá cả, khả năng, thống kê sử dụng và thông tin provider. Đây là nguồn dữ liệu cho trang Models.

lines
$curl "https://api.tramlabs.io/public/models"

Cấu trúc response

lines
1{
2 "models": [
3 /* Array of PublicModel objects */
4 ]
5}

Cấu trúc đối tượng PublicModel

Mỗi model trong mảng models sẽ bao gồm các trường sau:

TrườngKiểu dữ liệuMô tả
modelNamestringTên model dùng trong request API (ví dụ: "gemini-3.5-flash")
displayNamestringTên hiển thị thân thiện với người dùng (ví dụ: "Gemini 3.5 Flash")
modestring | nullLoại model: chat, completion, embedding, image_generation, video_generation, audio_speech, audio_transcription, rerank
providersProvider[]Danh sách các provider cung cấp model này
contextLengthnumber | nullKích thước context window tối thiểu (tokens) — “from {context}” floor
contextVariesbooleantrue nếu context length khác nhau giữa các provider
maxTokensnumber | nullSố token tối đa trong response (max across providers)
inputCostPerTokennumber | nullChi phí mỗi input token (VND). null nếu chưa có giá
inputCostVariesbooleantrue nếu giá input khác nhau giữa các provider hoặc có tiered pricing
outputCostPerTokennumber | nullChi phí mỗi output token (VND). null nếu chưa có giá
outputCostVariesbooleantrue nếu giá output khác nhau giữa các provider hoặc có tiered pricing
outputCostPerSecondVndnumber | nullChi phí mỗi giây video output (VND). Chỉ video models
inputCostPerCharacterVndnumber | nullChi phí mỗi ký tự input (VND). Chỉ TTS models (ElevenLabs)
inputCostPerSecondVndnumber | nullChi phí mỗi giây audio input (VND). Chỉ STT models
outputCostPerImageVndnumber | nullChi phí mỗi ảnh tạo ra (VND). Flat-fee image models
outputCostPerImageTokenVndnumber | nullChi phí mỗi image output token (VND)
outputCostPerAudioTokenVndnumber | nullChi phí mỗi audio output token (VND)
inputCostPerQueryVndnumber | nullChi phí mỗi rerank query (VND). Rerank models
capabilitiesRecord<string, boolean>Các khả năng của model (xem bảng bên dưới)
description{ vi: string, en: string }Mô tả chi tiết về model theo ngôn ngữ
tagsstring[] | nullCác tag phân loại model
createdAtnumber | nullThời gian Unix khi model được thêm vào
statsModelUsageStats | nullThống kê sử dụng 7 ngày gần nhất. null nếu chưa có dữ liệu
videoConstraintsVideoConstraints | nullRàng buộc video (chỉ khi modevideo_generation). Xem API Reference

Đối tượng Provider

lines
1{
2 "key": string, // Provider key (ví dụ: "openai", "anthropic", "azure")
3 "displayName": string // Tên hiển thị (ví dụ: "OpenAI", "Anthropic", "Azure OpenAI")
4}

Đối tượng ModelUsageStats

lines
1{
2 "tokensWeek": number, // Tổng token sử dụng trong 7 ngày qua
3 "avgLatencyMs": number | null, // Latency trung bình (ms)
4 "throughputTokensPerSec": number | null // Tốc độ sinh token (tokens/giây, chỉ streaming)
5}

Các khả năng (Capabilities)

Trường capabilities cho biết các tính năng mà model hỗ trợ:

  • supports_vision - Xử lý hình ảnh đầu vào
  • supports_function_calling - Gọi hàm (Function/Tool calling)
  • supports_response_schema - Ép buộc định dạng đầu ra theo JSON schema
  • supports_prompt_caching - Hỗ trợ prompt caching
  • supports_reasoning - Chế độ suy luận nội bộ (Reasoning)
  • supports_computer_use - Điều khiển máy tính
  • supports_pdf_input - Đọc file PDF đầu vào

Chi tiết một model (/public/models/:model)

lines
$curl "https://api.tramlabs.io/public/models/Gemini%203.5%20Flash"

Trả về thông tin chi tiết kèm danh sách các provider (routes) với giá và cấu hình riêng:

lines
1{
2 "model": {
3 "modelName": "gemini-3.5-flash",
4 "displayName": "Gemini 3.5 Flash",
5 "mode": "chat",
6 "description": { "vi": "...", "en": "..." },
7 "tags": ["fast", "multimodal"],
8 "capabilities": { "supports_vision": true, "supports_function_calling": true },
9 "contextLength": 1048576,
10 "inputCostPerToken": 0.5,
11 "outputCostPerToken": 2.0,
12 "videoConstraints": null,
13 "stats": { "tokensWeek": 1250000, "avgLatencyMs": 450, "throughputTokensPerSec": 120 },
14 "activity": { "days": [{ "date": "2026-07-22", "tokens": 150000 }], "totalTokens": 5400000 },
15 "routes": [
16 {
17 "provider": { "key": "google", "displayName": "Google" },
18 "contextLength": 1048576,
19 "maxTokens": 65536,
20 "inputCostPerToken": 0.5,
21 "outputCostPerToken": 2.0,
22 "stats": { "throughputTokensPerSec": 120, "avgLatencyMs": 450 }
23 }
24 ]
25 }
26}

Bảng xếp hạng model (/public/models/rankings)

lines
$# Xếp hạng theo tuần (mặc định)
$curl "https://api.tramlabs.io/public/models/rankings"
$
$# Xếp hạng theo ngày hoặc tháng
$curl "https://api.tramlabs.io/public/models/rankings?period=today"
$curl "https://api.tramlabs.io/public/models/rankings?period=month"
lines
1{
2 "period": "week",
3 "rankings": [
4 {
5 "rank": 1,
6 "modelName": "gemini-3.5-flash",
7 "tokens": 1250000,
8 "trendPct": 15.3
9 }
10 ]
11}

Mỗi model có cách tách từ (Tokenize) văn bản khác nhau

Một số model chia nhỏ văn bản thành các cụm gồm nhiều ký tự (như GPT, Claude, Llama, v.v.), trong khi một số khác lại tách nhỏ theo từng ký tự đơn lẻ (như PaLM). Điều này đồng nghĩa với việc số lượng token (và kéo theo là chi phí) sẽ có sự chênh lệch giữa các model, ngay cả khi người dùng truyền vào cùng một dữ liệu đầu vào và nhận về cùng một kết quả đầu ra.

Chi phí hiển thị và hóa đơn sẽ được tính dựa trên bộ tách token (tokenizer) của chính model đang sử dụng. Người dùng có thể kiểm tra trường usage trong dữ liệu phản hồi trả về để nắm được số lượng token chính xác của cả phần input lẫn output.