UniAPI API Doc
  1. Responses
UniAPI API Doc
  • OpenAI
    • Audio
      • 文本生成音频
      • 音频转文本
      • 创建转录
    • Chat
      • 聊天接口
    • Completions
      • 自动补全
    • Embeddings
      • 向量接口
    • Images
      • 图像编辑
      • 图像生成
      • 图像变体
    • Models
      • 获取模型列表
    • Moderations
      • 审核
    • Responses
      • response
        POST
  • 平台接口
    • 余额
      GET
  • 音乐模型
    • Suno
      • 创建音乐
      • 创建歌词
      • 批量获取任务
      • 查询单个任务
    • Udio
      • 创建音乐
      • 查询任务
  • 图像模型
    • MidJourney
      • 提交swap_face任务
      • 绘图变化(UPSCALE; VARIATION; REROLL)
      • 执行动作(所有的关联按钮动作UPSCALE; VARIATION; REROLL; ZOOM等)
      • 绘图变化-simple(UPSCALE; VARIATION; REROLL)
      • 提交Blend任务(图生图)
      • 提交Describe任务(图生文)
      • 提交Imagine任务(文生图、文图生图)
      • 提交Modal(提交局部重绘、ZOOM)
      • 提交Shorten任务(prompt分析)
    • ideogram
      • Generates(文生图)
      • Remix(混合图)
      • Upscale(放大高清)
      • Describe(描述)
    • FalAI
      • Openai 格式
      • 提交任务
      • 获取任务状态
      • 获取任务结果
    • 即梦
      • Openai 格式
    • Kling
      • 图像生成(文生图/图生图)
      • 图像生成 获取状态
      • 虚拟试穿
      • 虚拟试穿 获取状态
  • 视频模型
    • Luma
      • 生成视频
      • 扩展视频
      • 获取下载地址
      • 获取任务
    • FalAI
      • 提交任务
      • 获取任务状态
      • 获取任务结果
    • Kling
      • 图像生成(文生图/图生图)
      • 图像生成 获取状态
      • 文生视频
      • 文生视频 获取状态
      • 图生视频
      • 图生视频 获取状态
      • 虚拟试穿
      • 虚拟试穿 获取状态
  1. Responses

response

POST
/v1/responses
Responses

请求参数

Authorization
在 Header 添加参数
Authorization
,其值为在 Bearer 之后拼接 Token
示例:
Authorization: Bearer ********************
Body 参数application/json
previous_response_id
string  | null 
可选
之前对模型的响应的唯一ID。使用此ID来创建多轮对话。
model
string 
可选
用于生成响应的模型ID,如 gpt-4o 或 o3。
reasoning
可选
One of
o-series models only
Configuration options for
reasoning models.
effort
enum<string>  | enum<null> 
可选
仅限o系列模型
限制推理模型的推理努力
推理模型。
当前支持的值为low(低)、medium(中)和high(高)。减少推理努力可以带来更快的响应速度和在响应中使用更少的推理令牌。
枚举值:
lowmediumhigh
默认值:
medium
summary
enum<string>  | enum<null> 
可选
模型执行的推理摘要。这对于调试和理解模型的推理过程非常有用。
选项之一:auto、concise 或 detailed。
枚举值:
autoconcisedetailed
generate_summary
enum<string>  | enum<null> 
已废弃
已弃用:请改用 summary。
模型执行推理的摘要。这对于调试和理解模型的推理过程非常有用。
可选值之一:auto、concise 或 detailed。
枚举值:
autoconcisedetailed
max_output_tokens
integer  | null 
可选
响应中可以生成的令牌数量的上限,包括可见输出令牌和推理令牌
instructions
string  | null 
可选
将系统(或开发者)消息作为模型上下文中的第一个项目插入。
当与 previous_response_id 一起使用时,之前响应中的指令不会被带入下一次响应。这使得在新响应中替换系统(或开发者)消息变得简单。
text
object 
可选
模型文本响应的配置选项。可以是纯文本或结构化的JSON数据。
format
TextResponseFormatConfiguration
可选
An object specifying the format that the model must output.
Configuring { "type": "json_schema" } enables Structured Outputs,
which ensures the model will match your supplied JSON schema. Learn more in the
Structured Outputs guide.
The default format is { "type": "text" } with no additional options.
Not recommended for gpt-4o and newer models:
Setting to { "type": "json_object" } enables the older JSON mode, which
ensures the message the model generates is valid JSON. Using json_schema
is preferred for models that support it.
tools
array[null (Tool) {4}] 
可选
模型在生成响应时可能调用的一组工具。您可以通过设置 tool_choice 参数来指定使用哪个工具。
object 
File search
可选
A tool that searches for relevant content from uploaded files. Learn more about the file search tool.
object 
Function
可选
Defines a function in your own code the model can choose to call. Learn more about function calling.
object 
Web search preview
可选
This tool searches the web for relevant results to use in a response. Learn more about the web search tool.
object 
Computer use preview
可选
A tool that controls a virtual computer. Learn more about the computer tool.
tool_choice
可选
模型在生成响应时应如何选择使用哪个工具(或哪些工具)。请参阅 tools 参数以了解如何指定模型可以调用的工具。
One of
Controls which (if any) tool is called by the model.
none means the model will not call any tool and instead generates a message.
auto means the model can pick between generating a message or calling one or
more tools.
required means the model must call one or more tools.
枚举值:
noneautorequired
truncation
enum<string>  | enum<null> 
可选
用于模型响应的截断策略。
auto:如果本次响应及之前的上下文超过了模型的上下文窗口大小,模型将通过丢弃对话中间的输入项来截断响应,以适应上下文窗口。
disabled(默认):如果模型响应将超过模型的上下文窗口大小,请求将以400错误失败。
枚举值:
autodisabled
默认值:
disabled
input
必需
文本、图像或文件输入到模型,用于生成响应。
One of
A text input to the model, equivalent to a text input with the
user role.
include
array[string] | null 
可选
指定要在模型响应中包含的额外输出数据。目前支持的值有:
file_search_call.results:包含文件搜索工具调用的搜索结果。
message.input_image.image_url:包含输入消息中的图片网址。
computer_call_output.output.image_url:包含计算机调用输出中的图片网址。
枚举值:
file_search_call.resultsmessage.input_image.image_urlcomputer_call_output.output.image_url
parallel_tool_calls
boolean  | null 
可选
是否允许模型并行运行工具调用。
默认值:
true
store
boolean  | null 
可选
是否存储生成的模型响应以便通过API稍后检索。
默认值:
true
stream
boolean  | null 
可选
如果设置为 true,模型响应数据将在生成时通过服务器发送事件流式传输到客户端。
默认值:
false
metadata
object  | null 
Metadata
可选
一组由16个键值对组成的数据,可以附加到一个对象上。这对于以结构化格式存储有关该对象的附加信息以及通过API或仪表板查询对象非常有用。
键是字符串,最大长度为64个字符。值是字符串,最大长度为512个字符。
temperature
number  | null 
可选
使用介于0到2之间的采样温度。较高的值如0.8会使输出更随机,而较低的值如0.2会使其更集中和确定。
我们通常建议调整此参数或top_p,但不要同时调整两者。
>= 0<= 2
默认值:
1
示例值:
1
top_p
number  | null 
可选
一种替代温度采样的方法,称为核采样(nucleus sampling),
在这种方法中,模型只考虑概率质量最高的前 p% 的 token。
因此,0.1 意味着只有构成前 10% 概率质量的 token 被考虑。
我们通常建议调整这个参数或 temperature,但不要同时调整两者。
>= 0<= 1
默认值:
1
示例值:
1
user
string 
可选
表示您的终端用户的唯一标识符,有助于 OpenAI 监控和检测滥用行为。
示例值:
user-1234
service_tier
enum<string>  | enum<null> 
ServiceTier
可选
指定用于处理请求的延迟层。此参数适用于订阅了规模层服务的客户:
如果设置为“auto”,且项目启用了规模层,系统将使用规模层积分,直到积分用尽。
如果设置为“auto”,且项目未启用规模层,请求将使用默认服务层处理,具有较低的正常运行时间SLA且不保证延迟。
如果设置为“default”,请求将使用默认服务层处理,具有较低的正常运行时间SLA且不保证延迟。
如果设置为“flex”,请求将使用灵活处理服务层处理。了解更多。
如果未设置此参数,默认行为为“auto”。
当设置此参数时,响应体将包含所使用的service_tier。
枚举值:
autodefaultflex
默认值:
auto
示例
{
    "metadata": {
        "property1": "string",
        "property2": "string"
    },
    "temperature": 1,
    "top_p": 1,
    "user": "user-1234",
    "service_tier": "auto",
    "previous_response_id": "string",
    "model": "string",
    "reasoning": {
        "effort": "medium",
        "summary": "auto",
        "generate_summary": "auto"
    },
    "max_output_tokens": 0,
    "instructions": "string",
    "text": {
        "format": {
            "type": "text"
        }
    },
    "tools": [
        {
            "type": "file_search",
            "vector_store_ids": [
                "string"
            ],
            "max_num_results": 0,
            "ranking_options": {
                "ranker": "auto",
                "score_threshold": 0
            },
            "filters": {
                "type": "eq",
                "key": "string",
                "value": "string"
            }
        }
    ],
    "tool_choice": "none",
    "truncation": "disabled",
    "input": "string",
    "include": [
        "file_search_call.results"
    ],
    "parallel_tool_calls": true,
    "store": true,
    "stream": false
}

示例代码

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://api.uniapi.io/v1/responses' \
--header 'Content-Type: application/json' \
--data-raw '{
    "metadata": {
        "property1": "string",
        "property2": "string"
    },
    "temperature": 1,
    "top_p": 1,
    "user": "user-1234",
    "service_tier": "auto",
    "previous_response_id": "string",
    "model": "string",
    "reasoning": {
        "effort": "medium",
        "summary": "auto",
        "generate_summary": "auto"
    },
    "max_output_tokens": 0,
    "instructions": "string",
    "text": {
        "format": {
            "type": "text"
        }
    },
    "tools": [
        {
            "type": "file_search",
            "vector_store_ids": [
                "string"
            ],
            "max_num_results": 0,
            "ranking_options": {
                "ranker": "auto",
                "score_threshold": 0
            },
            "filters": {
                "type": "eq",
                "key": "string",
                "value": "string"
            }
        }
    ],
    "tool_choice": "none",
    "truncation": "disabled",
    "input": "string",
    "include": [
        "file_search_call.results"
    ],
    "parallel_tool_calls": true,
    "store": true,
    "stream": false
}'

返回响应

🟢200成功
application/json
OK
Body
metadata
object  | null 
Metadata
可选
一组由16个键值对组成的数据,可以附加到一个对象上。这对于以结构化格式存储有关该对象的附加信息以及通过API或仪表板查询对象非常有用。
键是字符串,最大长度为64个字符。值是字符串,最大长度为512个字符。
temperature
number  | null 
可选
使用介于0到2之间的采样温度。较高的值如0.8会使输出更随机,而较低的值如0.2会使其更集中和确定。
我们通常建议调整此参数或top_p,但不要同时调整两者。
>= 0<= 2
默认值:
1
示例值:
1
top_p
number  | null 
可选
一种替代温度采样的方法,称为核采样(nucleus sampling),
在这种方法中,模型只考虑概率质量最高的前 p% 的 token。
因此,0.1 意味着只有构成前 10% 概率质量的 token 被考虑。
我们通常建议调整这个参数或 temperature,但不要同时调整两者。
>= 0<= 1
默认值:
1
示例值:
1
user
string 
可选
表示您的终端用户的唯一标识符,有助于 OpenAI 监控和检测滥用行为。
示例值:
user-1234
service_tier
enum<string>  | enum<null> 
ServiceTier
可选
指定用于处理请求的延迟层。此参数适用于订阅了规模层服务的客户:
如果设置为“auto”,且项目启用了规模层,系统将使用规模层积分,直到积分用尽。
如果设置为“auto”,且项目未启用规模层,请求将使用默认服务层处理,具有较低的正常运行时间SLA且不保证延迟。
如果设置为“default”,请求将使用默认服务层处理,具有较低的正常运行时间SLA且不保证延迟。
如果设置为“flex”,请求将使用灵活处理服务层处理。了解更多。
如果未设置此参数,默认行为为“auto”。
当设置此参数时,响应体将包含所使用的service_tier。
枚举值:
autodefaultflex
默认值:
auto
previous_response_id
string  | null 
可选
之前对模型的响应的唯一ID。使用此ID来创建多轮对话。
model
string 
可选
用于生成响应的模型ID,如 gpt-4o 或 o3。
reasoning
可选
One of
o-series models only
Configuration options for
reasoning models.
effort
enum<string>  | enum<null> 
可选
仅限o系列模型
限制推理模型的推理努力
推理模型。
当前支持的值为low(低)、medium(中)和high(高)。减少推理努力可以带来更快的响应速度和在响应中使用更少的推理令牌。
枚举值:
lowmediumhigh
默认值:
medium
summary
enum<string>  | enum<null> 
可选
模型执行的推理摘要。这对于调试和理解模型的推理过程非常有用。
选项之一:auto、concise 或 detailed。
枚举值:
autoconcisedetailed
generate_summary
enum<string>  | enum<null> 
已废弃
已弃用:请改用 summary。
模型执行推理的摘要。这对于调试和理解模型的推理过程非常有用。
可选值之一:auto、concise 或 detailed。
枚举值:
autoconcisedetailed
max_output_tokens
integer  | null 
可选
响应中可以生成的令牌数量的上限,包括可见输出令牌和推理令牌
instructions
string  | null 
可选
将系统(或开发者)消息作为模型上下文中的第一个项目插入。
当与 previous_response_id 一起使用时,之前响应中的指令不会被带入下一次响应。这使得在新响应中替换系统(或开发者)消息变得简单。
text
object 
可选
模型文本响应的配置选项。可以是纯文本或结构化的JSON数据。
format
TextResponseFormatConfiguration
可选
An object specifying the format that the model must output.
Configuring { "type": "json_schema" } enables Structured Outputs,
which ensures the model will match your supplied JSON schema. Learn more in the
Structured Outputs guide.
The default format is { "type": "text" } with no additional options.
Not recommended for gpt-4o and newer models:
Setting to { "type": "json_object" } enables the older JSON mode, which
ensures the message the model generates is valid JSON. Using json_schema
is preferred for models that support it.
tools
array[null (Tool) {4}] 
可选
模型在生成响应时可能调用的一组工具。您可以通过设置 tool_choice 参数来指定使用哪个工具。
object 
File search
可选
A tool that searches for relevant content from uploaded files. Learn more about the file search tool.
object 
Function
可选
Defines a function in your own code the model can choose to call. Learn more about function calling.
object 
Web search preview
可选
This tool searches the web for relevant results to use in a response. Learn more about the web search tool.
object 
Computer use preview
可选
A tool that controls a virtual computer. Learn more about the computer tool.
tool_choice
可选
模型在生成响应时应如何选择使用哪个工具(或哪些工具)。请参阅 tools 参数以了解如何指定模型可以调用的工具。
One of
Controls which (if any) tool is called by the model.
none means the model will not call any tool and instead generates a message.
auto means the model can pick between generating a message or calling one or
more tools.
required means the model must call one or more tools.
枚举值:
noneautorequired
truncation
enum<string>  | enum<null> 
可选
用于模型响应的截断策略。
auto:如果本次响应及之前的上下文超过了模型的上下文窗口大小,模型将通过丢弃对话中间的输入项来截断响应,以适应上下文窗口。
disabled(默认):如果模型响应将超过模型的上下文窗口大小,请求将以400错误失败。
枚举值:
autodisabled
默认值:
disabled
id
string 
必需
此响应的唯一标识符。
object
enum<string> 
必需
该资源的对象类型 - 始终设置为 response。
枚举值:
response
status
enum<string> 
可选
响应生成的状态。取值为 completed(已完成)、failed(失败)、in_progress(进行中)或 incomplete(未完成)之一。
枚举值:
completedfailedin_progressincomplete
created_at
number 
必需
此响应创建时的Unix时间戳(以秒为单位)。
error
object  | null 
ResponseError
必需
当模型未能生成响应时返回的错误对象。
code
enum<string> 
ResponseErrorCode
必需
响应的错误代码。
枚举值:
server_errorrate_limit_exceededinvalid_promptvector_store_timeoutinvalid_imageinvalid_image_formatinvalid_base64_imageinvalid_image_urlimage_too_largeimage_too_smallimage_parse_errorimage_content_policy_violationinvalid_image_modeimage_file_too_largeunsupported_image_media_typeempty_image_filefailed_to_download_imageimage_file_not_found
message
string 
错误描述
必需
incomplete_details
object  | null 
必需
关于响应不完整的详细信息。
reason
enum<string> 
可选
The reason why the response is incomplete.
枚举值:
max_output_tokenscontent_filter
output
array[null (OutputItem) {6}] 
必需
由模型生成的内容项数组。
output 数组中项目的长度和顺序取决于模型的响应。
与其访问 output 数组中的第一个项目并假设它是模型生成内容的 assistant 消息,不如在支持的 SDK 中考虑使用 output_text 属性。
object 
Output message
可选
来自模型的输出信息。
object 
File search tool call
可选
文件搜索工具调用的结果。
object 
Function tool call
可选
调用函数的工具。
object 
Web search tool call
可选
网络搜索工具的结果
object 
Computer tool call
可选
工具调用计算机使用工具。
object 
Reasoning
可选
推理模型在生成响应时所使用的思维链描述。
output_text
string  | null 
可选
仅限 SDK 的便利属性,包含 output 数组中所有 output_text 项的聚合文本输出(如果存在)。
支持 Python 和 JavaScript SDK。
usage
object 
ResponseUsage
可选
表示令牌使用详情,包括输入令牌、输出令牌、输出令牌的细分以及使用的总令牌数。
input_tokens
integer 
输入令牌的数量。
必需
input_tokens_details
object 
必需
输入令牌的详细分解。
output_tokens
integer 
输出令牌的数量。
必需
output_tokens_details
object 
必需
输出令牌的详细分解。
total_tokens
integer 
使用的令牌总数。
必需
parallel_tool_calls
boolean 
必需
是否允许模型并行运行工具调用。
默认值:
true
示例
{
    "metadata": {
        "property1": "string",
        "property2": "string"
    },
    "temperature": 1,
    "top_p": 1,
    "user": "user-1234",
    "service_tier": "auto",
    "previous_response_id": "string",
    "model": "string",
    "reasoning": {
        "effort": "medium",
        "summary": "auto",
        "generate_summary": "auto"
    },
    "max_output_tokens": 0,
    "instructions": "string",
    "text": {
        "format": {
            "type": "text"
        }
    },
    "tools": [
        {
            "type": "file_search",
            "vector_store_ids": [
                "string"
            ],
            "max_num_results": 0,
            "ranking_options": {
                "ranker": "auto",
                "score_threshold": 0
            },
            "filters": {
                "type": "eq",
                "key": "string",
                "value": "string"
            }
        }
    ],
    "tool_choice": "none",
    "truncation": "disabled",
    "id": "string",
    "object": "response",
    "status": "completed",
    "created_at": 0,
    "error": {
        "code": "server_error",
        "message": "string"
    },
    "incomplete_details": {
        "reason": "max_output_tokens"
    },
    "output": [
        {
            "id": "string",
            "type": "message",
            "role": "assistant",
            "content": [
                {
                    "type": "output_text",
                    "text": "string",
                    "annotations": [
                        {
                            "type": "file_citation",
                            "file_id": "string",
                            "index": 0
                        }
                    ]
                }
            ],
            "status": "in_progress"
        }
    ],
    "output_text": "string",
    "usage": {
        "input_tokens": 0,
        "input_tokens_details": {
            "cached_tokens": 0
        },
        "output_tokens": 0,
        "output_tokens_details": {
            "reasoning_tokens": 0
        },
        "total_tokens": 0
    },
    "parallel_tool_calls": true
}
修改于 2025-05-18 07:36:21
上一页
审核
下一页
余额
Built with