ChatCompletions格式
根据对话历史创建模型响应。支持流式和非流式输出。
兼容 OpenAI Chat Completions API。
POST
/v1/chat/completions
https://api.covanexus.com
Authorization
Body
Authorization
Authorization BearerAuth
Authorization Bearer <token>
使用 Bearer Token 认证。格式:Authorization: Bearer $COVA_NEXUS_API_KEY
in: header
Request Body
application/json
model* string
模型 ID
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
音频输出配置
Response Body
| 状态码 | 类型 |
|---|---|
| 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