跳转到主要内容
POST
/
v1
/
responses
curl --request POST \
  --url https://api.getinfinityblue.com/v1/responses \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "gpt-5.4",
  "input": "用一句话介绍你自己。"
}
'
{
  "id": "<string>",
  "object": "<string>",
  "created_at": 123,
  "model": "<string>",
  "output": [
    {
      "type": "<string>",
      "id": "<string>",
      "status": "<string>",
      "role": "<string>",
      "content": [
        {
          "type": "<string>",
          "text": "<string>"
        }
      ]
    }
  ],
  "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
    }
  }
}

可填写的模型

模型 ID说明
gpt-5.4GPT-5 系列旗舰,顶级推理 / 编码 / Agentic,1M 上下文
gpt-5.4-mini轻量均衡版,适合高频调用与兜底
deepseek-v4-proDeepSeek 高性价比推理模型
完整列表见 GET /v1/models

多轮对话续接

通过 previous_response_id 字段传入上一轮响应的 id, 即可在无需重复发送完整上下文的情况下延续对话。

推理控制

对支持推理的模型,通过 reasoning.effortlow / medium / high) 控制推理深度;通过 reasoning.summaryauto / concise / detailed) 控制推理摘要的详细程度。

上下文截断

truncation 设置为 auto 时,系统自动截断超出上下文窗口的旧内容; 设置为 disabled 时,若请求超出窗口将返回错误。

授权

Authorization
string
header
必填

使用 Bearer Token 认证,格式:Authorization: Bearer sk-xxxxxx。 在 控制台 获取 API Key。

请求体

application/json

OpenAI Responses API 请求体。

model
string
必填

模型 ID,例如 gpt-5.4。完整列表见 GET /v1/models

示例:

"gpt-5.4"

input

输入内容,可以是纯文本字符串,或包含多条消息的数组。 若省略,须通过 previous_response_id 续接上一轮对话。

instructions
string

系统级指令,等同于 Chat Completions 中的 system 消息。

max_output_tokens
integer

模型在本次响应中可生成的最大 token 数(含推理 token)。

temperature
number

采样温度,取值 0–2,控制输出的随机性。

必填范围: 0 <= x <= 2
top_p
number

核采样概率阈值,与 temperature 二选一调整。

必填范围: 0 <= x <= 1
stream
boolean
默认值:false

是否以 Server-Sent Events 流式返回。

tools
object[]

模型可调用的工具列表。

tool_choice

工具调用策略。字符串 auto/none/required, 或指定具体工具的对象。

可用选项:
auto,
none,
required
reasoning
object

推理配置,仅对支持推理的模型生效。

previous_response_id
string

上一轮响应的 id。填入后可在不重复发送历史上下文的情况下 延续多轮对话。

truncation
enum<string>

上下文截断策略。auto 自动截断超出窗口的旧内容; disabled 超出时返回错误。

可用选项:
auto,
disabled

响应

成功创建响应

OpenAI Responses API 响应体。

id
string

本次响应的唯一标识,可用作下一轮的 previous_response_id

object
string

对象类型,值为 response

示例:

"response"

created_at
integer

创建时间的 Unix 时间戳(秒)。

status
enum<string>

响应状态。

可用选项:
completed,
failed,
in_progress,
incomplete
model
string

实际处理请求的模型。

output
object[]

模型生成的输出块列表。

usage
object

本次请求的 token 用量统计。