Skip to content

Chat Completions

POST https://api.zonetoken.net/v1/chat/completions

Sinh 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ườngKiểuMô tả
modelstringId của model, ví dụ gpt-5.5.
messagesarrayCuộc hội thoại hiện tại, dạng các object { role, content }.
temperaturenumberTùy chọn. Độ ngẫu nhiên khi sinh (0–2).
streambooleanTù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
  }
}