DeerAPI OpenAI Responses 接口(POST /v1/responses)文档:支持文本/图像多模态输入、函数调用与工具集成,实现有状态对话与高质量文本输出。
curl https://api.deerapi.com/v1/responses \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <DEERAPI_KEY>" \
-d '{
"model": "gpt-4.1",
"input": "Tell me a three sentence bedtime story about a unicorn."
}'{
"id": "<string>",
"object": "<string>",
"created_at": 123,
"status": "<string>",
"background": true,
"content_filters": null,
"error": null,
"incomplete_details": null,
"instructions": null,
"max_output_tokens": null,
"max_tool_calls": null,
"model": "<string>",
"output": [
{
"id": "<string>",
"type": "<string>",
"status": "<string>",
"content": [
{
"type": "<string>",
"annotations": [
"<string>"
],
"logprobs": [
"<string>"
],
"text": "<string>"
}
],
"role": "<string>",
"phase": "<string>"
}
],
"parallel_tool_calls": true,
"previous_response_id": null,
"prompt_cache_key": null,
"reasoning": {
"effort": "<unknown>",
"summary": "<unknown>"
},
"safety_identifier": null,
"service_tier": "<string>",
"store": true,
"temperature": 123,
"text": {
"format": {
"type": "<string>"
},
"verbosity": "<string>"
},
"tool_choice": "<string>",
"tools": [
"<string>"
],
"top_logprobs": 123,
"top_p": 123,
"truncation": "<string>",
"usage": {
"input_tokens": 123,
"input_tokens_details": {
"cached_tokens": 123
},
"output_tokens": 123,
"output_tokens_details": {
"reasoning_tokens": 123
},
"total_tokens": 123
},
"user": "<unknown>",
"metadata": {},
"output_text": "<string>"
}responses 是 OpenAI 最先进的模型响应生成接口,支持更丰富的交互能力和工具集成。
responses 接口的详细信息,建议参考 OpenAI 官方文档。
OpenAI 相关指南:
Bearer token authentication. Use your DeerAPI key.
兼容 OpenAI Responses API。对于新项目,如果你需要统一处理多模态输入、推理模型、结构化输出、工具调用或会话续接,通常优先选择这个接口。这里的参数说明更偏向日常使用,而不是逐字照搬官方术语。
输入内容。最简单时直接传字符串;需要多轮对话、多模态或显式角色时,再传消息数组。推荐优先从字符串或单条 user 消息开始,只有在确实需要上下文拼接、图像或文件输入时再切到结构化数组。
要调用的模型 ID。适合 Responses 的通常是新一代 OpenAI 文本或推理模型。示例:gpt-5.4、gpt-5-mini、gpt-4.1。
系统级说明,用来设定回答身份、风格、边界或输出约束。它和 Chat Completions 里的 developer/system 消息作用相近,但写起来更直接。
是否启用 SSE 流式输出。需要边生成边显示、长任务进度可见或工具调用过程可视化时,建议打开。
是否让任务在后台执行。适合超长任务或不希望前端持续占用连接的场景。
上一轮 Responses 的 ID。用于续接会话时最省事,不必把完整历史重新拼回 input。如果你需要替换系统说明,可继续传新的 instructions。
把请求显式挂到一个 conversation 上。可以传对话 ID 字符串或配置对象。它和 previous_response_id 一样都能管理上下文,但两者不要同时使用。
采样温度,范围通常为 0-2。抽取、分类、结构化输出建议偏低;创意写作、头脑风暴可适当提高。
0 <= x <= 2限制这次响应最多生成多少 token。对于推理模型,它通常同时约束可见输出和思考 token。
核采样阈值,范围 0-1。更适合希望控制候选词覆盖范围的场景。
0 <= x <= 1推理相关配置。对支持推理的模型,可以在这里控制思考强度和是否返回思维摘要。并不是所有模型都支持。
Show child attributes
文本输出配置。最常见的用法是要求 JSON 输出或调低/调高文本冗长度。
Show child attributes
允许模型调用的工具列表。既可以是你自定义的 function 工具,也可以是模型原生支持的内建工具。
Show child attributes
控制工具选择策略。可以让模型自动判断,也可以强制使用某一个工具。
是否允许模型并行发起多个工具调用。需要多个独立查询同时执行时很有用。
要求响应里额外带回更多调试或中间结果,例如工具调用明细、logprobs、图片 URL 等。适合排查行为或做高级工作流编排。
附加业务元数据,最多 16 组键值。适合挂任务 ID、租户 ID、链路追踪字段。
上下文超长时的处理策略。disabled 会直接报错;auto 允许系统自动裁剪较早内容。
auto, disabled 是否存储本次响应,便于后续检索、续接或审计。
提示词缓存键。对高频、长前缀、模板化请求尤其有价值,可以帮助提高缓存命中率。
提示词缓存保留时间策略。
in-memory, 24h 限制本次请求中内建工具的总调用次数上限。超出后模型的工具调用请求会被忽略。
每个位置返回前 N 个最可能的 token 及其 log 概率。
0 <= x <= 20流式输出的附加控制项。只有 stream=true 时才需要传。
Show child attributes
引用已保存的提示词模板及其变量。
Show child attributes
更适合新项目的终端用户稳定标识,可用于安全风控和违规追踪。
指定处理档位。不同档位在延迟、价格和可用性上会有区别。
auto, default, flex, priority 旧版最终用户标识字段。新项目更建议使用 safety_identifier 或 prompt_cache_key。
成功
本次API请求的唯一标识符。
返回对象的类型,
本次请求所使用的具体模型名称。
响应输出项。最常见的是 message,但在工具调用或推理场景下也可能出现其他 item 类型。
Show child attributes
Show child attributes
Show child attributes
本次请求的 token 使用量统计。
Show child attributes
用户标识。未传时通常为 null。
服务端聚合后的纯文本输出。需要注意的是,当前兼容层下这个字段不一定总会填充;若返回 null,请改为遍历 output[].content[] 中 type=output_text 的文本块。
curl https://api.deerapi.com/v1/responses \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <DEERAPI_KEY>" \
-d '{
"model": "gpt-4.1",
"input": "Tell me a three sentence bedtime story about a unicorn."
}'{
"id": "<string>",
"object": "<string>",
"created_at": 123,
"status": "<string>",
"background": true,
"content_filters": null,
"error": null,
"incomplete_details": null,
"instructions": null,
"max_output_tokens": null,
"max_tool_calls": null,
"model": "<string>",
"output": [
{
"id": "<string>",
"type": "<string>",
"status": "<string>",
"content": [
{
"type": "<string>",
"annotations": [
"<string>"
],
"logprobs": [
"<string>"
],
"text": "<string>"
}
],
"role": "<string>",
"phase": "<string>"
}
],
"parallel_tool_calls": true,
"previous_response_id": null,
"prompt_cache_key": null,
"reasoning": {
"effort": "<unknown>",
"summary": "<unknown>"
},
"safety_identifier": null,
"service_tier": "<string>",
"store": true,
"temperature": 123,
"text": {
"format": {
"type": "<string>"
},
"verbosity": "<string>"
},
"tool_choice": "<string>",
"tools": [
"<string>"
],
"top_logprobs": 123,
"top_p": 123,
"truncation": "<string>",
"usage": {
"input_tokens": 123,
"input_tokens_details": {
"cached_tokens": 123
},
"output_tokens": 123,
"output_tokens_details": {
"reasoning_tokens": 123
},
"total_tokens": 123
},
"user": "<unknown>",
"metadata": {},
"output_text": "<string>"
}