Chat Completions 格式
根據對話歷史建立模型響應。支援流式和非流式輸出。
相容 OpenAI Chat Completions API。
POST
/v1/chat/completions
https://api.covanexus.com
Authorization
內容
Authorization
Authorization BearerAuth
Authorization Bearer <token>
使用 Bearer Token 認證。格式:Authorization: Bearer $COVA_NEXUS_API_KEY
in: 標頭
請求內容
application/json
model* string
模型識別碼
messages* array[object]
對話訊息列表
temperature? number
取樣溫度
Default 1 | Range 0 ≤ value ≤ 2
top_p? number
核取樣引數
Default 1 | Range 0 ≤ value ≤ 1
n? integer
生成數量
Default 1 ≥ value
stream? boolean
是否流式輸出
Default false
stream_options? object
流式輸出選項
stop? string | array[string]
停止字串
max_tokens? integer
最大生成 Token 數
max_completion_tokens? integer
最大補全 Token 數
presence_penalty? number
存在懲罰
Default 0 | Range -2 ≤ value ≤ 2
frequency_penalty? number
頻率懲罰
Default 0 | Range -2 ≤ value ≤ 2
logit_bias? object
詞元偏置
user? string
使用者標識
tools? array[object]
可用工具清單(Function Calling)
tool_choice? string | object
工具選擇策略
response_format? object
響應格式
seed? integer
隨機種子
reasoning_effort? string
推理強度(用於支援推理的模型)
Value in "low" | "medium" | "high"
modalities? array[string]
輸出模態
audio? object
音訊輸出設定
回應內容
| 狀態碼 | 型別 |
|---|---|
| 200 | application/json |
| 400 | application/json |
| 429 | application/json |
curl -X POST "https://api.covanexus.com/v1/chat/completions" \
-H "Authorization: Bearer " \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4",
"messages": [
{
"role": "system",
"content": "string"
},
{
"role": "user",
"content": "string"
}
]
}'200
400
429
{
"id": "string",
"object": "chat.completion",
"created": 0,
"model": "string",
"choices": [
{
"index": 0,
"message": {
"role": "system",
"content": "string"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 0,
"completion_tokens": 0,
"total_tokens": 0
}
}BearerAuth