Số dư credit
GET
https://sangtao.ai/api/v2/account/balanceTài liệu cho Số dư credit.
Lấy số dư credit hiện tại. Kiểm tra trước khi gửi job tạo nội dung để đảm bảo đủ credit.
cURL
bash
curl https://sangtao.ai/api/v2/account/balance \
-H "X-Api-Key: YOUR_API_KEY"Phản hồi
json
{
"success": true,
"data": {
"freeCredit": 50,
"purchasedCredit": 100,
"lockedCredit": 8,
"availableCredit": 142,
"hasPurchased": true,
"apiKey": "stai_a1b2c3d4e5f6...",
"topupMemo": "891188"
}
}| Field | Type | Description |
|---|---|---|
| freeCredit | number | Credit miễn phí từ gói subscription / bonus dùng thử. Reset hàng tháng |
| purchasedCredit | number | Credit đã mua. Không hết hạn |
| lockedCredit | number | Credit đang giữ cho các job đang chạy |
| availableCredit | number | freeCredit + purchasedCredit - lockedCredit |
| hasPurchased | boolean | User đã từng mua credit chưa |
| apiKey | string | API key cũ của tài khoản, trả về đầy đủ — coi response này là bí mật |
| topupMemo | string | Mã tham chiếu cho nạp credit qua chuyển khoản |
Thứ tự trừ credit
Note: Credit trừ từ freeCredit trước, rồi mới đến purchasedCredit. Kiểm tra availableCredit >= chi phí ước tính trước khi gửi job.