鉴权与连接
- Base URL
https://backend:8000- Authorization
Authorization: Bearer YOUR_API_KEY- Content-Type
application/json- 模型名 (model)
gpt-5.4
接入协议
为什么选这个协议
适合已有 OpenAI SDK、Chat Completions 代码或统一网关接入的用户。
接口地址
POST/v1/chat/completions
Authorization: Bearer YOUR_API_KEYContent-Type: application/json请求 / 响应 JSON
// REQUEST
{
"model": "gpt-5.4",
"messages": [
{
"content": "你好,世界",
"role": "user"
}
],
"system_instruction": "你是一个严谨的助手。",
"temperature": 0.7,
"top_p": 1,
"max_tokens": 4096,
"stream": false,
"reasoning_effort": "medium",
"response_format": {
"type": "json_object"
},
"tools": [],
"tool_choice": "auto"
}// RESPONSE
{
"id": "chatcmpl_example",
"model": "gpt-5.5",
"choices": [
{
"message": {
"content": "你好,世界"
}
}
],
"usage": {
"prompt_tokens": 8,
"completion_tokens": 16,
"total_tokens": 24
}
}请求字段 / 响应字段
// INPUT SCHEMA
| 字段 | 类型 | 必填 |
|---|---|---|
| messages | array | Y |
| system_instruction | string | N |
| temperature | number | N |
| top_p | number | N |
| max_tokens | integer | N |
| stream | boolean | N |
| reasoning_effort | enum | N |
| response_format | object | N |
| tools | array | N |
| tool_choice | string | N |
// RESPONSE SCHEMA
| 字段 | 类型 | 必填 |
|---|---|---|
| id | string | N |
| model | string | N |
| choices[].message.content | string | N |
| usage.prompt_tokens | integer | N |
| usage.completion_tokens | integer | N |
| usage.total_tokens | integer | N |
代码示例
cURLrequest.sh
curl -X POST "https://backend:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "gpt-5.4",
"messages": [
{
"content": "你好,世界",
"role": "user"
}
],
"system_instruction": "你是一个严谨的助手。",
"temperature": 0.7,
"top_p": 1,
"max_tokens": 4096,
"stream": false,
"reasoning_effort": "medium",
"response_format": {
"type": "json_object"
},
"tools": [],
"tool_choice": "auto"
}'