Chuyển đến nội dung chính
POST
/
v1
/
chat
/
completions
Tạo cuộc hội thoại chat
curl --request POST \
  --url https://api.aiid.edu.kg/v1/chat/completions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "gpt-4",
  "messages": [
    {
      "content": "<string>",
      "name": "<string>",
      "tool_calls": [
        {
          "id": "<string>",
          "type": "function",
          "function": {
            "name": "<string>",
            "arguments": "<string>"
          }
        }
      ],
      "tool_call_id": "<string>",
      "reasoning_content": "<string>"
    }
  ],
  "temperature": 1,
  "top_p": 1,
  "n": 1,
  "stream": false,
  "stream_options": {
    "include_usage": true
  },
  "stop": "<string>",
  "max_tokens": 123,
  "max_completion_tokens": 123,
  "presence_penalty": 0,
  "frequency_penalty": 0,
  "logit_bias": {},
  "user": "<string>",
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "<string>",
        "description": "<string>",
        "parameters": {}
      }
    }
  ],
  "response_format": {
    "json_schema": {}
  },
  "seed": 123,
  "modalities": [],
  "audio": {
    "voice": "<string>",
    "format": "<string>"
  }
}
'
{
  "id": "<string>",
  "object": "chat.completion",
  "created": 123,
  "model": "<string>",
  "choices": [
    {
      "index": 123,
      "message": {
        "content": "<string>",
        "name": "<string>",
        "tool_calls": [
          {
            "id": "<string>",
            "type": "function",
            "function": {
              "name": "<string>",
              "arguments": "<string>"
            }
          }
        ],
        "tool_call_id": "<string>",
        "reasoning_content": "<string>"
      }
    }
  ],
  "usage": {
    "prompt_tokens": 123,
    "completion_tokens": 123,
    "total_tokens": 123,
    "prompt_tokens_details": {
      "cached_tokens": 123,
      "text_tokens": 123,
      "audio_tokens": 123,
      "image_tokens": 123
    },
    "completion_tokens_details": {
      "text_tokens": 123,
      "audio_tokens": 123,
      "reasoning_tokens": 123
    }
  },
  "system_fingerprint": "<string>"
}

Ủy quyền

Authorization
string
header
bắt buộc

Sử dụng xác thực Bearer Token. Định dạng: Authorization: Bearer sk-xxxxxx

Nội dung

application/json
model
string
bắt buộc

ID mô hình

Ví dụ:

"gpt-4"

messages
object[]
bắt buộc

Danh sách tin nhắn hội thoại

temperature
number
mặc định:1

Nhiệt độ lấy mẫu

Phạm vi bắt buộc: 0 <= x <= 2
top_p
number
mặc định:1

Tham số Nucleus Sampling

Phạm vi bắt buộc: 0 <= x <= 1
n
integer
mặc định:1

Số lượng tạo

Phạm vi bắt buộc: x >= 1
stream
boolean
mặc định:false

Có phản hồi dạng luồng (streaming) hay không

stream_options
object
stop

Chuỗi dừng

max_tokens
integer

Số lượng Token tạo ra tối đa

max_completion_tokens
integer

Số Token hoàn thiện tối đa

presence_penalty
number
mặc định:0
Phạm vi bắt buộc: -2 <= x <= 2
frequency_penalty
number
mặc định:0
Phạm vi bắt buộc: -2 <= x <= 2
logit_bias
object
user
string
tools
object[]
tool_choice
Tùy chọn có sẵn:
none,
auto,
required
response_format
object
seed
integer
reasoning_effort
enum<string>

Cường độ suy luận (dùng cho các mô hình hỗ trợ suy luận)

Tùy chọn có sẵn:
low,
medium,
high
modalities
enum<string>[]
Tùy chọn có sẵn:
text,
audio
audio
object

Phản hồi

Phản hồi tạo thành công

id
string
object
string
Ví dụ:

"chat.completion"

created
integer
model
string
choices
object[]
usage
object
system_fingerprint
string