curl --fail-with-body --silent --show-error --max-time 600 \
--request POST \
--url https://code.heihuzi.ai/v1/chat/completions \
--header "Authorization: Bearer $HEIHUZI_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"model": "gpt-5.5",
"messages": [
{
"role": "user",
"content": "Reply with exactly API_OK."
}
]
}' \
--output chat.json
OpenAI API 调用
Chat Completions
gpt-5.5 的 messages 请求、普通响应与流式响应。
POST
/
v1
/
chat
/
completions
curl --fail-with-body --silent --show-error --max-time 600 \
--request POST \
--url https://code.heihuzi.ai/v1/chat/completions \
--header "Authorization: Bearer $HEIHUZI_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"model": "gpt-5.5",
"messages": [
{
"role": "user",
"content": "Reply with exactly API_OK."
}
]
}' \
--output chat.json
POST https://code.heihuzi.ai/v1/chat/completions 的非流式和流式均已使用 gpt-5.5 验证。
curl --fail-with-body --silent --show-error --max-time 600 \
--request POST \
--url https://code.heihuzi.ai/v1/chat/completions \
--header "Authorization: Bearer $HEIHUZI_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"model": "gpt-5.5",
"messages": [
{
"role": "user",
"content": "Reply with exactly API_OK."
}
]
}' \
--output chat.json
请求参数
string
required
本页验证
gpt-5.5;省略返回 400。object[]
required
示例传入一条
role: "user"、content 为字符串的消息;省略返回 400。boolean
已验证省略时返回 JSON,设为
true 返回 SSE。number
流式用例使用
0.2。integer
流式用例使用
256 作为请求输出长度上限。返回值
非流式从choices[].message.content 读取文本。本次响应节选如下。
{
"object": "chat.completion",
"model": "gpt-5.5",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "API_OK"
},
"finish_reason": "stop"
}
]
}
{
"model": "gpt-5.5",
"messages": [
{
"role": "user",
"content": "Reply with exactly API_OK."
}
],
"stream": true,
"temperature": 0.2,
"max_tokens": 256
}
text/event-stream,文本分片位于 choices[].delta.content,结束标记为 data: [DONE]。使用 Responses 的客户端应按该接口的独立结构读取。