AI 模型接口聊天(Chat)原生OpenAI格式
⚠️合规提示:本项目仅用于合法授权的 API 网关、内部管理和私有化部署场景。请遵守上游服务条款、平台规则、监管要求和内容安全要求。
ChatCompletions格式
根据对话历史创建模型响应。支持流式和非流式响应。
兼容 OpenAI Chat Completions API。
AuthorizationBearer <token>
使用 Bearer Token 认证。
格式: Authorization: Bearer sk-xxxxxx
位置:header
modelstring
模型 ID
messages
对话消息列表
temperature?number
采样温度
默认值
1范围
0 <= value <= 2top_p?number
核采样参数
默认值
1范围
0 <= value <= 1n?integer
生成数量
默认值
1范围
1 <= valuestream?boolean
是否流式响应
默认值
falsestream_options?
stop?string|
停止序列
max_tokens?integer
最大生成 Token 数
max_completion_tokens?integer
最大补全 Token 数
presence_penalty?number
默认值
0范围
-2 <= value <= 2frequency_penalty?number
默认值
0范围
-2 <= value <= 2logit_bias?
user?string
tools?
tool_choice?string|
response_format?
seed?integer
reasoning_effort?string
推理强度 (用于支持推理的模型)
允许值
"low" | "medium" | "high"modalities?array<string>
audio?
响应体
application/json
application/json
application/json
curl -X POST "https://api.beeaicloud.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"
}
}这篇文档对您有帮助吗?