跳转到主要内容
The Responses API is OpenAI’s newer stateful conversation API. LemonData supports this format as an advanced optional path for compatible models; use POST /v1/chat/completions as the default OpenAI-compatible route unless you explicitly need Responses-specific behavior.

Request Body

model
string
必填
要使用的模型 ID。可用选项请参见 Models
input
array
必填
由对话组成的输入项列表。每个项可以是:
  • message: 带有角色和内容的对话消息
  • function_call: 一个函数调用请求
  • function_call_output: 来自函数调用的输出
对于多模态输入,message.content 可以是普通字符串,也可以是内容块数组。对于支持图像的模型(例如 GPT-5.4 变体),请将图像作为 input_image 块传递,而不是将 URL 或 Base64 字符串直接嵌入普通文本中。示例内容块:
  • { "type": "input_text", "text": "Describe this image" }
  • { "type": "input_image", "image_url": "https://example.com/image.jpg" }
  • { "type": "input_image", "image_url": "data:image/png;base64,..." }
instructions
string
提供给模型的系统指令(等同于 system 消息)。
max_output_tokens
integer
生成的最大 token 数量。
temperature
number
默认值:"1"
采样温度,范围在 0 到 2 之间。
tools
array
模型可能调用的工具列表。
stream
boolean
默认值:"false"
如果为 true,则返回事件流。
previous_response_id
string
用于从某个先前响应继续对话的响应 ID。
store
boolean
默认值:"true"
是否存储响应以便后续检索。
metadata
object
附加到响应以用于跟踪的元数据。
text
object
文本生成的配置选项。text.format 的行为取决于所选模型和路由路径;并不保证在每个模型上都一致。
parallel_tool_calls
boolean
默认值:"true"
是否允许并行进行多个工具调用。
top_p
number
Nucleus 采样参数(0-1)。
reasoning
object
针对具备推理能力的模型(例如 GPT-5 系列变体)的推理配置。
  • effort (string): 推理努力级别(low, medium, high

Response

id
string
响应的唯一标识符。
object
string
始终为 response
created
integer
响应创建时的 Unix 时间戳。
output
array
模型生成的输出项列表。
usage
object
token 使用统计。
curl -X POST "https://api.lemondata.cc/v1/responses" \
  -H "Authorization: Bearer sk-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4o",
    "input": [
      {"type": "message", "role": "user", "content": "Hello!"}
    ],
    "max_output_tokens": 1000
  }'
{
  "id": "resp_abc123",
  "object": "response",
  "created": 1706000000,
  "model": "gpt-4o",
  "output": [
    {
      "type": "message",
      "role": "assistant",
      "content": [
        {"type": "text", "text": "Hello! How can I help you today?"}
      ]
    }
  ],
  "usage": {
    "input_tokens": 10,
    "output_tokens": 12,
    "total_tokens": 22
  }
}