curl --request POST \
--url https://api.getinfinityblue.com/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "gpt-5.4",
"messages": [
{
"role": "user",
"content": "用一句话介绍你自己。"
}
]
}
'{
"id": "<string>",
"object": "chat.completion",
"created": 123,
"model": "<string>",
"choices": [
{
"index": 123,
"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": 123,
"completion_tokens": 123,
"total_tokens": 123,
"prompt_tokens_details": {
"cached_tokens": 123,
"text_tokens": 123,
"audio_tokens": 123,
"image_tokens": 123
},
"completion_tokens_details": {
"text_tokens": 123,
"audio_tokens": 123,
"reasoning_tokens": 123
}
},
"system_fingerprint": "<string>"
}{
"error": {
"message": "无效的时长。支持的范围为 4 到 15 秒。",
"type": "invalid_request_error",
"param": "seconds",
"code": "invalid_duration"
}
}{
"error": {
"message": "无效的时长。支持的范围为 4 到 15 秒。",
"type": "invalid_request_error",
"param": "seconds",
"code": "invalid_duration"
}
}{
"error": {
"message": "无效的时长。支持的范围为 4 到 15 秒。",
"type": "invalid_request_error",
"param": "seconds",
"code": "invalid_duration"
}
}{
"error": {
"message": "无效的时长。支持的范围为 4 到 15 秒。",
"type": "invalid_request_error",
"param": "seconds",
"code": "invalid_duration"
}
}创建对话补全
以 OpenAI 兼容格式生成文本、视觉、工具调用与流式响应
curl --request POST \
--url https://api.getinfinityblue.com/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "gpt-5.4",
"messages": [
{
"role": "user",
"content": "用一句话介绍你自己。"
}
]
}
'{
"id": "<string>",
"object": "chat.completion",
"created": 123,
"model": "<string>",
"choices": [
{
"index": 123,
"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": 123,
"completion_tokens": 123,
"total_tokens": 123,
"prompt_tokens_details": {
"cached_tokens": 123,
"text_tokens": 123,
"audio_tokens": 123,
"image_tokens": 123
},
"completion_tokens_details": {
"text_tokens": 123,
"audio_tokens": 123,
"reasoning_tokens": 123
}
},
"system_fingerprint": "<string>"
}{
"error": {
"message": "无效的时长。支持的范围为 4 到 15 秒。",
"type": "invalid_request_error",
"param": "seconds",
"code": "invalid_duration"
}
}{
"error": {
"message": "无效的时长。支持的范围为 4 到 15 秒。",
"type": "invalid_request_error",
"param": "seconds",
"code": "invalid_duration"
}
}{
"error": {
"message": "无效的时长。支持的范围为 4 到 15 秒。",
"type": "invalid_request_error",
"param": "seconds",
"code": "invalid_duration"
}
}{
"error": {
"message": "无效的时长。支持的范围为 4 到 15 秒。",
"type": "invalid_request_error",
"param": "seconds",
"code": "invalid_duration"
}
}可填写的模型
在model 中传入任意对话类模型 ID,例如:
| 模型 ID | 说明 |
|---|---|
gpt-5.4 | GPT-5 系列旗舰,顶级推理 / 编码 / Agentic,1M 上下文 |
gpt-5.4-mini | 轻量均衡版,适合高频调用与兜底 |
gemini-3.1-pro-preview | Gemini 旗舰,强多模态,1M 上下文 |
deepseek-v4-pro | DeepSeek 高性价比推理模型 |
GET /v1/models
或 模型价格页。
流式输出
设置stream: true 即可接收 Server-Sent Events(SSE)。
每行格式为 data: {json},流以 data: [DONE] 结束:
data: {"id":"chatcmpl-...","choices":[{"delta":{"content":"你"}}]}
data: {"id":"chatcmpl-...","choices":[{"delta":{"content":"好"}}]}
data: [DONE]
推理模型
对支持推理的模型,可用reasoning_effort(low / medium /
high)控制推理深度。模型会在响应消息的 reasoning_content
字段返回推理过程,建议在 UI 中默认折叠展示。
工具调用
在tools 中以 JSON Schema 定义函数,模型会返回结构化的
tool_calls,由你的程序执行后把结果回填到下一轮请求中。
用 tool_choice 控制调用策略(auto / none / required
或指定具体函数)。授权
请求体
模型 ID,例如 gpt-5.4。完整列表见 GET /v1/models。
"gpt-5.4"
到目前为止构成对话的消息列表,按时间顺序排列。
Show child attributes
Show child attributes
采样温度,取值 0–2。较高的值(如 0.8)会让输出更随机,
较低的值(如 0.2)会让输出更聚焦、更确定。建议与 top_p
二选一调整。
0 <= x <= 2核采样(nucleus sampling)。模型只考虑累积概率达到 top_p
的 token,例如 0.1 表示只考虑概率最高的前 10%。建议与
temperature 二选一调整。
0 <= x <= 1为每条输入消息生成的补全数量。
x >= 1是否以 Server-Sent Events 流式返回。
流式输出的附加选项,仅在 stream=true 时生效。
Show child attributes
Show child attributes
最多 4 个停止序列。模型生成到其中任一序列时停止。
本次补全可生成的最大 token 数(旧字段)。推理类模型请改用
max_completion_tokens。
本次补全可生成的最大 token 数(含推理 token)。
存在惩罚,取值 -2.0–2.0。正值会根据新 token 是否已在文本中 出现来惩罚它们,从而提高模型谈论新话题的可能性。
-2 <= x <= 2频率惩罚,取值 -2.0–2.0。正值会根据 token 已出现的频率来 惩罚它们,降低逐字重复的可能性。
-2 <= x <= 2调整指定 token 出现概率的偏置表,键为 token ID,值为 -100–100。
Show child attributes
Show child attributes
代表终端用户的唯一标识,可用于滥用监测。
模型可调用的工具列表,目前仅支持 function 类型。
Show child attributes
Show child attributes
控制模型是否及如何调用工具。none 表示不调用,auto 由模型
自行决定,required 强制至少调用一个;也可传对象指定具体函数。
none, auto, required 控制模型输出格式。
Show child attributes
Show child attributes
随机种子。传入相同的 seed 和参数时尽量返回一致的结果。
推理强度,仅对支持推理的模型生效。
low, medium, high 期望模型返回的模态类型。
text, audio 音频输出参数,当 modalities 包含 audio 时使用。
Show child attributes
Show child attributes