Models

List Models

GET /v1/models

Liệt kê tất cả model khả dụng. Yêu cầu API key. Tương thích với OpenAI Models API.

Request

$curl https://api.staging.tram.ai.vn/v1/models \
> -H "Authorization: Bearer $TRAM_AI_API_KEY"

Response

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

Public Models

GET /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.

Request

$curl https://api.staging.tram.ai.vn/public/models

Response

1{
2 "models": [
3 {
4 "modelName": "google/gemini-2.5-flash",
5 "mode": "chat",
6 "providers": [
7 { "key": "google", "displayName": "Google" }
8 ],
9 "contextLength": 1048576,
10 "contextVaries": false,
11 "maxTokens": 65536,
12 "inputCostPerToken": 0.5,
13 "inputCostVaries": false,
14 "outputCostPerToken": 2.0,
15 "outputCostVaries": false,
16 "capabilities": {
17 "supports_vision": true,
18 "supports_function_calling": true
19 },
20 "description": "...",
21 "tags": ["fast", "multimodal"],
22 "createdAt": 1719900000,
23 "stats": {
24 "tokensWeek": 1250000,
25 "avgLatencyMs": 450,
26 "throughputTokensPerSec": 120
27 }
28 }
29 ]
30}

Các trường của PublicModel

TrườngKiểu dữ liệuMô tả
modelNamestringTên model dùng trong request API (ví dụ: "google/gemini-2.5-flash")
modestring | nullLoại model: chat, embedding, image_generation, video, audio_speech
providersProvider[]Danh sách các provider cung cấp model này
contextLengthnumber | nullKích thước context window tối đa (tokens)
contextVariesbooleantrue nếu context length khác nhau giữa các provider
maxTokensnumber | nullSố token tối đa trong response
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
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
capabilitiesRecord<string, boolean>Các khả năng của model (xem bên dưới)
descriptionstring | nullMô tả chi tiết về model
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

Capabilities

  • 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

Public Model Detail

GET /public/models/:model

Trả về thông tin chi tiết của một model kèm danh sách các provider (routes) với giá và cấu hình riêng. Không cần xác thực.

Request

$curl https://api.staging.tram.ai.vn/public/models/google/gemini-2.5-flash

Response

1{
2 "model": {
3 "modelName": "google/gemini-2.5-flash",
4 "description": "...",
5 "tags": ["fast", "multimodal"],
6 "capabilities": { "supports_vision": true, "supports_function_calling": true },
7 "contextLength": 1048576,
8 "inputCostPerToken": 0.5,
9 "outputCostPerToken": 2.0,
10 "routes": [
11 {
12 "provider": { "key": "google", "displayName": "Google" },
13 "contextLength": 1048576,
14 "maxTokens": 65536,
15 "inputCostPerToken": 0.5,
16 "outputCostPerToken": 2.0
17 }
18 ]
19 }
20}

Public Model Rankings

GET /public/models/rankings

Bảng xếp hạng model theo mức sử dụng. Không cần xác thực.

Query parameters

Tham sốGiá trịMặc địnhMô tả
periodtoday, week, monthweekKhoảng thời gian xếp hạng

Request

$# Xếp hạng theo tuần (mặc định)
$curl https://api.staging.tram.ai.vn/public/models/rankings
$
$# Xếp hạng theo ngày hoặc tháng
$curl https://api.staging.tram.ai.vn/public/models/rankings?period=today
$curl https://api.staging.tram.ai.vn/public/models/rankings?period=month

Response

1{
2 "period": "week",
3 "rankings": [
4 {
5 "rank": 1,
6 "modelName": "google/gemini-2.5-flash",
7 "tokens": 1250000,
8 "trendPct": 15.3
9 }
10 ]
11}