API Mô Hình AITrò chuyệnĐịnh dạng OpenAI gốc
Định dạng ChatCompletions
Tạo phản hồi của mô hình dựa trên lịch sử hội thoại. Hỗ trợ phản hồi streaming và không streaming.
Tương thích với API OpenAI Chat Completions.
Xác thực
BearerAuth
AuthorizationBearer <token>
Sử dụng xác thực Bearer Token.
Định dạng: Authorization: Bearer sk-xxxxxx
In: header
Nội dung yêu cầu
application/json
model*string
ID mô hình
messages*
Danh sách tin nhắn hội thoại
temperature?number
Sampling temperature
Default
1Range
0 <= value <= 2top_p?number
Nucleus sampling parameters
Default
1Range
0 <= value <= 1n?integer
Generation Count
Default
1Range
1 <= valuestream?boolean
Is streaming response
Default
falsestream_options?
stop?string|
Stop sequence
max_tokens?integer
Maximum number of generated tokens
max_completion_tokens?integer
Maximum completion tokens
presence_penalty?number
Default
0Range
-2 <= value <= 2frequency_penalty?number
Default
0Range
-2 <= value <= 2logit_bias?
user?string
tools?
tool_choice?string|
response_format?
seed?integer
reasoning_effort?string
Inference Intensity (Model used to support inference)
Value in
"low" | "medium" | "high"modalities?array<string>
audio?
curl -X POST "https://us-api.tokenhub.com/v1/chat/completions" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-4", "messages": [ { "role": "system", "content": "string" } ] }'{
"id": "string",
"object": "chat.completion",
"created": 0,
"model": "string",
"choices": [
{
"index": 0,
"message": {
"role": "system",
"content": "string",
"name": "string",
"tool_calls": [
{
"id": "string",
"type": "function",
"function": {
"name": "string",
"arguments": "string"
}
}
],
"tool_call_id": "string",
"reasoning_content": "string"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 0,
"completion_tokens": 0,
"total_tokens": 0,
"prompt_tokens_details": {
"cached_tokens": 0,
"text_tokens": 0,
"audio_tokens": 0,
"image_tokens": 0
},
"completion_tokens_details": {
"text_tokens": 0,
"audio_tokens": 0,
"reasoning_tokens": 0
}
},
"system_fingerprint": "string"
}{
"error": {
"message": "string",
"type": "string",
"param": "string",
"code": "string"
}
}{
"error": {
"message": "string",
"type": "string",
"param": "string",
"code": "string"
}
}Nội dung phản hồi
application/json
application/json
application/json
Cập nhật lần cuối vào