Chat Completions
POST https://api.zonetoken.net/v1/chat/completionsSinh phản hồi của model cho một cuộc hội thoại. Endpoint này tương thích với OpenAI Chat Completions API.
Xác thực
Authorization: Bearer <apiKey>Body của request
| Trường | Kiểu | Mô tả |
|---|---|---|
model | string | Id của model, ví dụ gpt-5.5. |
messages | array | Cuộc hội thoại hiện tại, dạng các object { role, content }. |
temperature | number | Tùy chọn. Độ ngẫu nhiên khi sinh (0–2). |
stream | boolean | Tùy chọn. Stream token theo server-sent events. |
Request
bash
curl https://api.zonetoken.net/v1/chat/completions \
-H "Authorization: Bearer $ZONETOKEN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.5",
"messages": [
{ "role": "system", "content": "Bạn là một trợ lý hữu ích." },
{ "role": "user", "content": "Giải thích ZoneToken trong một câu." }
],
"temperature": 0.7
}'json
{
"model": "gpt-5.5",
"messages": [
{ "role": "system", "content": "Bạn là một trợ lý hữu ích." },
{ "role": "user", "content": "Giải thích ZoneToken trong một câu." }
],
"temperature": 0.7
}Response
json
{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"created": 1730000000,
"model": "gpt-5.5",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "ZoneToken là một cổng API tương thích OpenAI mà bạn có thể dùng với các công cụ và SDK sẵn có."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 24,
"completion_tokens": 19,
"total_tokens": 43
}
}