curl --request POST \
--url https://api.dreamto.ai/v1/responses \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "gpt-6.2-sol",
"input": "用三句话介绍一下量子计算。"
}
'{
"id": "resp_67ccd3a9da748190baa7f1570fe91ac604becb25c45c1d41",
"object": "response",
"access_programs": null,
"created_at": 1741476777,
"status": "completed",
"completed_at": 1741476778,
"error": null,
"incomplete_details": null,
"instructions": null,
"max_output_tokens": null,
"model": "gpt-6.2-astra",
"output": [
{
"type": "message",
"id": "msg_67ccd3acc8d48190a77525dc6de64b4104becb25c45c1d41",
"status": "completed",
"role": "assistant",
"content": [
{
"type": "output_text",
"text": "The image depicts a scenic landscape with a wooden boardwalk or pathway leading through lush, green grass under a blue sky with some clouds. The setting suggests a peaceful natural area, possibly a park or nature reserve. There are trees and shrubs in the background.",
"annotations": [],
"logprobs": []
}
]
}
],
"parallel_tool_calls": true,
"previous_response_id": null,
"reasoning": {
"effort": null,
"summary": null,
"context": null
},
"temperature": 1,
"text": {
"format": {
"type": "text"
}
},
"tool_choice": "auto",
"tools": [],
"top_p": 1,
"truncation": "disabled",
"usage": {
"input_tokens": 328,
"input_tokens_details": {
"cached_tokens": 0,
"cache_write_tokens": 0
},
"output_tokens": 52,
"output_tokens_details": {
"reasoning_tokens": 0
},
"total_tokens": 380
},
"tool_usage": {
"image_gen": {
"input_tokens": 0,
"input_tokens_details": {
"text_tokens": 0,
"image_tokens": 0
},
"output_tokens": 0,
"output_tokens_details": {
"text_tokens": 0,
"image_tokens": 0
},
"total_tokens": 0
},
"web_search": {
"num_requests": 0
}
},
"user": null,
"metadata": {}
}{
"error": {
"code": "invalid_request",
"http_status": 400,
"message": "Invalid request.",
"request_id": "req_3f9a1c2b7d4e5f60718293a4",
"type": "invalid_request_error"
}
}{
"error": {
"code": "unauthorized",
"http_status": 401,
"message": "Unauthorized.",
"request_id": "req_3f9a1c2b7d4e5f60718293a4",
"type": "authentication_error"
}
}{
"error": {
"code": "insufficient_balance",
"http_status": 402,
"message": "Insufficient balance.",
"request_id": "req_3f9a1c2b7d4e5f60718293a4",
"type": "insufficient_balance_error"
}
}{
"error": {
"code": "forbidden",
"http_status": 403,
"message": "Access denied.",
"request_id": "req_3f9a1c2b7d4e5f60718293a4",
"type": "permission_error"
}
}{
"error": {
"code": "not_found",
"http_status": 404,
"message": "The requested model was not found.",
"request_id": "req_3f9a1c2b7d4e5f60718293a4",
"type": "invalid_request_error"
}
}{
"error": {
"code": "rate_limit_exceeded",
"http_status": 429,
"message": "Rate limit exceeded. Please try again later.",
"request_id": "req_3f9a1c2b7d4e5f60718293a4",
"type": "rate_limit_error"
}
}{
"error": {
"code": "api_error",
"http_status": 500,
"message": "Internal server error.",
"request_id": "req_3f9a1c2b7d4e5f60718293a4",
"type": "api_error"
}
}{
"error": {
"code": "service_unavailable",
"http_status": 503,
"message": "Service temporarily unavailable. Please try again later.",
"request_id": "req_3f9a1c2b7d4e5f60718293a4",
"type": "api_error"
}
}创建模型响应
curl --request POST \
--url https://api.dreamto.ai/v1/responses \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "gpt-6.2-sol",
"input": "用三句话介绍一下量子计算。"
}
'{
"id": "resp_67ccd3a9da748190baa7f1570fe91ac604becb25c45c1d41",
"object": "response",
"access_programs": null,
"created_at": 1741476777,
"status": "completed",
"completed_at": 1741476778,
"error": null,
"incomplete_details": null,
"instructions": null,
"max_output_tokens": null,
"model": "gpt-6.2-astra",
"output": [
{
"type": "message",
"id": "msg_67ccd3acc8d48190a77525dc6de64b4104becb25c45c1d41",
"status": "completed",
"role": "assistant",
"content": [
{
"type": "output_text",
"text": "The image depicts a scenic landscape with a wooden boardwalk or pathway leading through lush, green grass under a blue sky with some clouds. The setting suggests a peaceful natural area, possibly a park or nature reserve. There are trees and shrubs in the background.",
"annotations": [],
"logprobs": []
}
]
}
],
"parallel_tool_calls": true,
"previous_response_id": null,
"reasoning": {
"effort": null,
"summary": null,
"context": null
},
"temperature": 1,
"text": {
"format": {
"type": "text"
}
},
"tool_choice": "auto",
"tools": [],
"top_p": 1,
"truncation": "disabled",
"usage": {
"input_tokens": 328,
"input_tokens_details": {
"cached_tokens": 0,
"cache_write_tokens": 0
},
"output_tokens": 52,
"output_tokens_details": {
"reasoning_tokens": 0
},
"total_tokens": 380
},
"tool_usage": {
"image_gen": {
"input_tokens": 0,
"input_tokens_details": {
"text_tokens": 0,
"image_tokens": 0
},
"output_tokens": 0,
"output_tokens_details": {
"text_tokens": 0,
"image_tokens": 0
},
"total_tokens": 0
},
"web_search": {
"num_requests": 0
}
},
"user": null,
"metadata": {}
}{
"error": {
"code": "invalid_request",
"http_status": 400,
"message": "Invalid request.",
"request_id": "req_3f9a1c2b7d4e5f60718293a4",
"type": "invalid_request_error"
}
}{
"error": {
"code": "unauthorized",
"http_status": 401,
"message": "Unauthorized.",
"request_id": "req_3f9a1c2b7d4e5f60718293a4",
"type": "authentication_error"
}
}{
"error": {
"code": "insufficient_balance",
"http_status": 402,
"message": "Insufficient balance.",
"request_id": "req_3f9a1c2b7d4e5f60718293a4",
"type": "insufficient_balance_error"
}
}{
"error": {
"code": "forbidden",
"http_status": 403,
"message": "Access denied.",
"request_id": "req_3f9a1c2b7d4e5f60718293a4",
"type": "permission_error"
}
}{
"error": {
"code": "not_found",
"http_status": 404,
"message": "The requested model was not found.",
"request_id": "req_3f9a1c2b7d4e5f60718293a4",
"type": "invalid_request_error"
}
}{
"error": {
"code": "rate_limit_exceeded",
"http_status": 429,
"message": "Rate limit exceeded. Please try again later.",
"request_id": "req_3f9a1c2b7d4e5f60718293a4",
"type": "rate_limit_error"
}
}{
"error": {
"code": "api_error",
"http_status": 500,
"message": "Internal server error.",
"request_id": "req_3f9a1c2b7d4e5f60718293a4",
"type": "api_error"
}
}{
"error": {
"code": "service_unavailable",
"http_status": 503,
"message": "Service temporarily unavailable. Please try again later.",
"request_id": "req_3f9a1c2b7d4e5f60718293a4",
"type": "api_error"
}
}授权
请求体
此字段正在被 safety_identifier 和 prompt_cache_key 取代。请改用 prompt_cache_key 以保持缓存优化。终端用户的稳定标识符。用于更好地对相似请求进行分桶以提高缓存命中率,并帮助 OpenAI 检测和防止滥用。了解更多。
"user-1234"
稳定标识符,用于帮助检测应用中可能违反 OpenAI 使用政策的用户。ID 应为唯一标识每个用户的字符串,最大长度为 128 个字符。建议对用户名或电子邮件地址进行哈希处理,以避免向我们发送任何身份识别信息。了解更多。
128"safety-identifier-1234"
OpenAI 用于缓存相似请求的响应,以优化缓存命中率。取代 user 字段。了解更多。
"prompt-cache-key-1234"
已弃用。请改用 prompt_cache_options.ttl。
提示缓存的保留策略。设为 24h 可启用扩展提示缓存,使缓存的前缀保持活跃更长时间,最长 24 小时。了解更多。此字段表示最长保留策略,而 prompt_cache_options.ttl 表示最短缓存生命周期。这两个字段相互独立,互不影响。对于 gpt-5.5、gpt-5.5-pro 及未来的模型,仅支持 24h。
对于同时支持 in_memory 和 24h 的较旧模型,默认值取决于组织的数据保留策略:
- 未启用 ZDR 的组织默认为
24h。 - 已启用 ZDR 的组织在未指定
prompt_cache_retention时默认为in_memory。
in_memory, 24h 模型上一个响应的唯一 ID。用于创建多轮对话。详见 对话状态。不能与 conversation 同时使用。
要使用的模型 ID,例如 gpt-6.2-sol。可用模型见模型介绍。
"gpt-6.2-sol"
是否在后台运行模型响应。了解更多。
模型在生成响应时可调用的工具数组。可通过设置 tool_choice 参数指定要使用的工具。
支持以下几类工具:
可用于生成响应的工具。
- 函数
- 文件搜索
- 计算机
- 计算机使用(预览版)
- 网页搜索
- MCP 工具
- 代码解释器
- Option 8
- 图像生成工具
- 本地 Shell 工具
- Shell 工具
- 自定义工具
- 命名空间
- 工具搜索工具
- 网页搜索(预览版)
- 应用补丁工具
Show child attributes
Show child attributes
对提示词模板及其变量的引用。了解更多。
Show child attributes
Show child attributes
提示缓存的选项。gpt-5.6 及更新的模型支持。默认情况下,OpenAI 会自动选择一个隐式缓存断点。可以通过 prompt_cache_breakpoint 为内容块添加显式断点。每个请求最多可写入四个断点。进行缓存匹配时,OpenAI 最多考虑对话中最近的 80 个断点,不限制内容块的回溯范围。将 mode 设为 explicit 可禁用隐式断点。ttl 默认为 30m。支持的生命周期取决于所用 API。最新详情请参阅 提示缓存指南。
Show child attributes
Show child attributes
指定处理该请求所使用的服务类型。
- 设为 'auto' 时,请求将使用项目设置中配置的服务层级处理。除非另行配置,项目默认使用 'default'。
- 设为 'default' 时,请求将按所选模型的标准价格和性能处理。
- 设为 'flex' 时,请求将使用 Flex Processing 服务层级处理。
- 如需在请求级别启用 Fast 模式,可在 Responses 或 Chat Completions 请求中传入
service_tier=fast或service_tier=priority参数。无论请求中指定的是service_tier=fast还是priority,响应中都会显示service_tier=priority。 - 设为 'ultrafast' 时,请求将使用受访问控制的 Ultrafast Processing 服务层级处理。该层级目前适用于
gpt-5.6-sol;通过该层级处理的响应会显示service_tier=ultrafast。 - 未设置时,默认行为为 'auto'。
设置了 service_tier 参数时,响应体中会包含 service_tier 值,该值取决于实际处理请求所用的处理模式,可能与参数中设置的值不同。
auto, default, flex, scale, priority, fast, ultrafast 推理模型 的配置选项。
Show child attributes
Show child attributes
指定要在模型响应中包含的额外输出数据。目前支持的值有:
web_search_call.action.sources:包含网页搜索工具调用的来源。code_interpreter_call.outputs:在代码解释器工具调用项中包含 Python 代码执行的输出。computer_call_output.output.image_url:包含计算机调用输出中的图像 URL。file_search_call.results:包含文件搜索工具调用的搜索结果。message.input_image.image_url:包含输入消息中的图像 URL。message.output_text.logprobs:在助手消息中包含对数概率。reasoning.encrypted_content:在推理项输出中包含推理 Token 的加密版本。这样在无状态使用 Responses API 时(例如store参数设为false,或组织已加入零数据保留计划时),推理项也可用于多轮对话。
指定要在模型响应中包含的额外输出数据。目前支持的值有:
web_search_call.results:包含网页搜索工具调用的搜索结果。web_search_call.action.sources:包含网页搜索工具调用的来源。code_interpreter_call.outputs:在代码解释器工具调用项中包含 Python 代码执行的输出。computer_call_output.output.image_url:包含计算机调用输出中的图片 URL。file_search_call.results:包含文件搜索工具调用的搜索结果。message.input_image.image_url:包含输入消息中的图片 URL。message.output_text.logprobs:在助手消息中包含对数概率。reasoning.encrypted_content:在推理项输出中包含推理 Token 的加密版本。这样在无状态使用 Responses API 时(例如store参数设为false,或组织已加入零数据保留计划时),推理项也可用于多轮对话。
file_search_call.results, web_search_call.results, web_search_call.action.sources, message.input_image.image_url, computer_call_output.output.image_url, code_interpreter_call.outputs, reasoning.encrypted_content, message.output_text.logprobs 是否存储生成的模型响应,以便之后通过 API 检索。省略时默认为 true。设为 true 时,响应数据将至少存储 30 天,但需遵守 数据保留例外情况。
设为 true 时,模型响应数据将在生成过程中通过 服务器发送事件(SSE) 流式传输给客户端。更多信息请参阅 下文的流式部分。
响应可生成的 Token 数上限,包括可见的输出 Token 和 推理 Token。
x >= 16响应
非流式请求返回 Response 对象;stream 为 true 时返回 SSE 事件流(text/event-stream),每个事件都是一个 ResponseStreamEvent。
要使用的模型 ID,例如 gpt-6.2-sol。可用模型见模型介绍。
"gpt-6.2-sol"
模型在生成响应时可调用的工具数组。可通过设置 tool_choice 参数指定要使用的工具。
支持以下几类工具:
可用于生成响应的工具。
- 函数
- 文件搜索
- 计算机
- 计算机使用(预览版)
- 网页搜索
- MCP 工具
- 代码解释器
- Option 8
- 图像生成工具
- 本地 Shell 工具
- Shell 工具
- 自定义工具
- 命名空间
- 工具搜索工具
- 网页搜索(预览版)
- 应用补丁工具
Show child attributes
Show child attributes
模型生成的内容项数组。
output数组中项的数量和顺序取决于模型的响应。- 与其访问
output数组中的第一项并假定它是包含模型生成内容的assistant消息,不如在 SDK 支持时使用output_text属性。
模型的输出消息。
- 输出消息
- 文件搜索工具调用
- 函数工具调用
- 函数工具调用输出
- 网页搜索工具调用
- 计算机工具调用
- 计算机工具调用输出
- 推理
- Option 9
- Option 10
- Option 11
- Option 12
- Option 13
- 压缩项
- 图像生成调用
- 代码解释器工具调用
- 本地 shell 调用
- 本地 shell 调用输出
- Shell 工具调用
- Shell 调用输出
- 应用补丁工具调用
- 应用补丁工具调用输出
- MCP 工具调用
- MCP 工具列表
- MCP 审批请求
- MCP 审批响应
- 自定义工具调用
- ResponseCustomToolCallOutputItem
Show child attributes
Show child attributes
插入模型上下文中的系统(或开发者)消息。
与 previous_response_id 一起使用时,上一个响应的指令不会延续到下一个响应。这样可以方便地在新响应中替换系统(或开发者)消息。
此字段正在被 safety_identifier 和 prompt_cache_key 取代。请改用 prompt_cache_key 以保持缓存优化。终端用户的稳定标识符。用于更好地对相似请求进行分桶以提高缓存命中率,并帮助 OpenAI 检测和防止滥用。了解更多。
"user-1234"
稳定标识符,用于帮助检测应用中可能违反 OpenAI 使用政策的用户。ID 应为唯一标识每个用户的字符串,最大长度为 128 个字符。建议对用户名或电子邮件地址进行哈希处理,以避免向我们发送任何身份识别信息。了解更多。
128"safety-identifier-1234"
OpenAI 用于缓存相似请求的响应,以优化缓存命中率。取代 user 字段。了解更多。
"prompt-cache-key-1234"
已弃用。请改用 prompt_cache_options.ttl。
提示缓存的保留策略。设为 24h 可启用扩展提示缓存,使缓存的前缀保持活跃更长时间,最长 24 小时。了解更多。此字段表示最长保留策略,而 prompt_cache_options.ttl 表示最短缓存生命周期。这两个字段相互独立,互不影响。对于 gpt-5.5、gpt-5.5-pro 及未来的模型,仅支持 24h。
对于同时支持 in_memory 和 24h 的较旧模型,默认值取决于组织的数据保留策略:
- 未启用 ZDR 的组织默认为
24h。 - 已启用 ZDR 的组织在未指定
prompt_cache_retention时默认为in_memory。
in_memory, 24h 模型上一个响应的唯一 ID。用于创建多轮对话。详见 对话状态。不能与 conversation 同时使用。
是否在后台运行模型响应。了解更多。
对提示词模板及其变量的引用。了解更多。
Show child attributes
Show child attributes
指定处理该请求所使用的服务类型。
- 设为 'auto' 时,请求将使用项目设置中配置的服务层级处理。除非另行配置,项目默认使用 'default'。
- 设为 'default' 时,请求将按所选模型的标准价格和性能处理。
- 设为 'flex' 时,请求将使用 Flex Processing 服务层级处理。
- 如需在请求级别启用 Fast 模式,可在 Responses 或 Chat Completions 请求中传入
service_tier=fast或service_tier=priority参数。无论请求中指定的是service_tier=fast还是priority,响应中都会显示service_tier=priority。 - 设为 'ultrafast' 时,请求将使用受访问控制的 Ultrafast Processing 服务层级处理。该层级目前适用于
gpt-5.6-sol;通过该层级处理的响应会显示service_tier=ultrafast。 - 未设置时,默认行为为 'auto'。
设置了 service_tier 参数时,响应体中会包含 service_tier 值,该值取决于实际处理请求所用的处理模式,可能与参数中设置的值不同。
auto, default, flex, scale, priority, fast, ultrafast 推理模型 的配置选项。
Show child attributes
Show child attributes
响应可生成的 Token 数上限,包括可见的输出 Token 和 推理 Token。

