Tài Liệu

API Documentation

01. Authentication

Sử dụng API key trong header x-api-key để xác thực.

x-api-key: YOUR_API_KEY

02. Chat API

Gửi tin nhắn và nhận phản hồi từ AI models.

POSThttps://api.vfam.shop/api/vfam/chat

Request Body

{
  "message": "Xin chào, bạn có thể giúp tôi viết code không?",
  "model": "claude-4.5-sonnet"  // optional
}

Response

{
  "success": true,
  "data": {
    "id": "uuid",
    "reply": "Chào bạn! Tôi có thể giúp bạn...",
    "model": "claude-4.5-sonnet",
    "tokens": {
      "input": 25,
      "output": 150,
      "total": 175,
      "remaining": 49825
    }
  }
}

03. History API

Xem lịch sử chat của bạn.

GEThttps://api.vfam.shop/api/vfam/history

Query Parameters

?limit=50&offset=0

Response

{
  "success": true,
  "data": {
    "total": 100,
    "messages": [
      {
        "id": "uuid",
        "userMessage": "Xin chào",
        "botReply": "Chào bạn!",
        "model": "claude-4.5-sonnet",
        "createdAt": "2026-01-01T00:00:00Z"
      }
    ]
  }
}

04. Usage API

Kiểm tra số token đã dùng và còn lại.

GEThttps://api.vfam.shop/api/auth/usage

Response

{
  "success": true,
  "data": {
    "email": "user@example.com",
    "tokenLimit": 100000,
    "tokensUsed": 15000,
    "tokensRemaining": 85000
  }
}

05. Models API

Danh sách AI models hiện có.

GEThttps://api.vfam.shop/api/vfam/models

Response

[
  {
    "id": "uuid",
    "modelName": "claude-4.5-sonnet",
    "displayName": "Claude 4.5 Sonnet",
    "provider": "Anthropic",
    "active": true
  },
  {
    "id": "uuid",
    "modelName": "gpt-4o",
    "displayName": "GPT-4o",
    "provider": "OpenAI",
    "active": true
  }
]

06. SDKs

Sử dụng SDK chính thức để tích hợp nhanh hơn.

JavaScript
npm install @vfam/sdk
Python
pip install vfam-sdk
Go
go get vfam/vfam-go