> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.tramlabs.io/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.tramlabs.io/_mcp/server.

# Liệt kê public models

GET https://api.tramlabs.io/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.


Reference: https://docs.tramlabs.io/api/endpoints/chat-completions/models/list-public-models

## Response

### 200

Thành công

- `models` (list of PublicModel, optional)

## Types

### PublicModel

- `modelName` (string, optional) — Tên model dùng trong request API
- `displayName` (string, optional) — Tên hiển thị thân thiện với người dùng
- `mode` (enum, optional) — Loại model
  - Allowed values: `chat`, `completion`, `embedding`, `image_generation`, `video_generation`, `audio_speech`, `audio_transcription`, `rerank`
- `providers` (list of PublicModelProvidersItems, optional)
- `contextLength` (integer, optional) — Kích thước context window tối thiểu (tokens) — "from \{context}" floor
- `contextVaries` (boolean, optional) — `true` nếu context length khác nhau giữa các provider
- `maxTokens` (integer, optional) — Số token tối đa trong response (max across providers)
- `inputCostPerToken` (double, optional) — Chi phí mỗi input token (VND). `null` nếu chưa có giá
- `inputCostVaries` (boolean, optional) — `true` nếu giá input khác nhau giữa các provider hoặc có tiered pricing
- `outputCostPerToken` (double, optional) — Chi phí mỗi output token (VND). `null` nếu chưa có giá
- `outputCostVaries` (boolean, optional) — `true` nếu giá output khác nhau giữa các provider hoặc có tiered pricing
- `outputCostPerSecondVnd` (double, optional) — Chi phí mỗi giây video output (VND). Chỉ có ở video models
- `inputCostPerCharacterVnd` (double, optional) — Chi phí mỗi ký tự input (VND). Chỉ có ở TTS models (ElevenLabs)
- `inputCostPerSecondVnd` (double, optional) — Chi phí mỗi giây audio input (VND). Chỉ có ở STT models
- `outputCostPerImageVnd` (double, optional) — Chi phí mỗi ảnh tạo ra (VND). Flat-fee image models
- `outputCostPerImageTokenVnd` (double, optional) — Chi phí mỗi image output token (VND). GPT-Image-style models
- `outputCostPerAudioTokenVnd` (double, optional) — Chi phí mỗi audio output token (VND). Token-priced TTS models
- `inputCostPerQueryVnd` (double, optional) — Chi phí mỗi rerank query (VND). Rerank models
- `capabilities` (map from string to boolean, optional) — Các khả năng: supports_vision, supports_function_calling, supports_response_schema, supports_prompt_caching, supports_reasoning, supports_computer_use, supports_pdf_input
- `description` (PublicModelDescription, optional) — Mô tả model theo ngôn ngữ
- `tags` (list of string, optional)
- `createdAt` (integer, optional) — Thời gian Unix khi model được thêm vào
- `stats` (PublicModelStats, optional) — Thống kê sử dụng 7 ngày gần nhất. `null` nếu chưa có dữ liệu
- `videoConstraints` (PublicModelVideoConstraints, optional) — Ràng buộc video. Chỉ có khi `mode` là `video_generation`

### PublicModelProvidersItems

- `key` (string, optional)
- `displayName` (string, optional)

### PublicModelDescription

Mô tả model theo ngôn ngữ

- `vi` (string, optional) — Mô tả tiếng Việt
- `en` (string, optional) — Mô tả tiếng Anh

### PublicModelStats

Thống kê sử dụng 7 ngày gần nhất. `null` nếu chưa có dữ liệu

- `tokensWeek` (integer, optional) — Tổng tokens trong 7 ngày
- `avgLatencyMs` (double, optional) — Latency trung bình (ms). `null` nếu không có dữ liệu
- `throughputTokensPerSec` (double, optional) — Throughput (tokens/giây, chỉ streaming calls). `null` nếu không có

### PublicModelVideoConstraints

Ràng buộc video. Chỉ có khi `mode` là `video_generation`

- `allowedDurations` (list of integer, optional) — Danh sách thời lượng cho phép (giây)
- `maxDurationSeconds` (integer, optional) — Thời lượng tối đa (giây)
- `supportedAspectRatios` (list of string, optional) — Tỷ lệ khung hình hỗ trợ (ví dụ: `16:9`, `9:16`)
- `supportsInputReference` (boolean, optional) — Hỗ trợ image-to-video (first frame)
- `supportsLastFrame` (boolean, optional) — Hỗ trợ last frame (chỉ Seedance)
- `lastFrameRequiresInputReference` (boolean, optional) — Last frame yêu cầu input_reference
- `supportsReferenceImages` (boolean, optional) — Hỗ trợ reference images
- `maxReferenceImages` (integer, optional) — Số reference images tối đa
- `maxStyleReferenceImages` (integer, optional) — Số style reference images tối đa. `null` nếu không giới hạn
- `referenceImagesMinDuration` (integer, optional) — Thời lượng tối thiểu khi dùng reference images (giây)
- `referenceImagesExcludesInputReference` (boolean, optional) — Không dùng reference_images cùng input_reference
- `contentExpiresAfterSeconds` (integer, optional) — Video hết hạn tải sau bao lâu (giây). `null` nếu không hết hạn
- `supportsGenerateAudio` (boolean, optional) — Hỗ trợ tạo audio đồng bộ. `null` nếu không rõ

## Examples

**Request**

```json
{}
```

**Response**

```json
{
  "models": [
    {
      "modelName": "gpt-4-vietnamese",
      "displayName": "GPT-4 Vietnamese",
      "mode": "chat",
      "providers": [
        {
          "key": "tramlabs",
          "displayName": "Tram Labs"
        },
        {
          "key": "openai",
          "displayName": "OpenAI"
        }
      ],
      "contextLength": 8192,
      "contextVaries": false,
      "maxTokens": 4096,
      "inputCostPerToken": 0.75,
      "inputCostVaries": true,
      "outputCostPerToken": 1.25,
      "outputCostVaries": true,
      "outputCostPerSecondVnd": null,
      "inputCostPerCharacterVnd": null,
      "inputCostPerSecondVnd": null,
      "outputCostPerImageVnd": null,
      "outputCostPerImageTokenVnd": null,
      "outputCostPerAudioTokenVnd": null,
      "inputCostPerQueryVnd": null,
      "capabilities": {
        "supports_vision": true,
        "supports_function_calling": true,
        "supports_response_schema": true,
        "supports_prompt_caching": false,
        "supports_reasoning": true,
        "supports_computer_use": false,
        "supports_pdf_input": true
      },
      "description": {
        "vi": "Mô hình GPT-4 hỗ trợ tiếng Việt, tối ưu cho hội thoại và xử lý ngôn ngữ tự nhiên.",
        "en": "GPT-4 model optimized for Vietnamese language, supporting chat and natural language processing."
      },
      "tags": [
        "large-language-model",
        "chat",
        "multilingual"
      ],
      "createdAt": 1685606400,
      "stats": {
        "tokensWeek": 12500000,
        "avgLatencyMs": 350,
        "throughputTokensPerSec": 1500
      },
      "videoConstraints": {
        "allowedDurations": [],
        "maxDurationSeconds": 0,
        "supportedAspectRatios": [],
        "supportsInputReference": false,
        "supportsLastFrame": false,
        "lastFrameRequiresInputReference": false,
        "supportsReferenceImages": false,
        "maxReferenceImages": 0,
        "maxStyleReferenceImages": null,
        "referenceImagesMinDuration": 0,
        "referenceImagesExcludesInputReference": false,
        "contentExpiresAfterSeconds": null,
        "supportsGenerateAudio": null
      }
    }
  ]
}
```

**SDK Code**

```python
import requests

url = "https://api.tramlabs.io/public/models"

payload = {}
headers = {"Content-Type": "application/json"}

response = requests.get(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.tramlabs.io/public/models';
const options = {method: 'GET', headers: {'Content-Type': 'application/json'}, body: '{}'};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.tramlabs.io/public/models"

	payload := strings.NewReader("{}")

	req, _ := http.NewRequest("GET", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.tramlabs.io/public/models")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request.body = "{}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.tramlabs.io/public/models")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.tramlabs.io/public/models', [
  'body' => '{}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.tramlabs.io/public/models");
var request = new RestRequest(Method.GET);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = [] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.tramlabs.io/public/models")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```