创建响应 (OpenAI Responses API)
POST /v1/responses
OpenAI Responses API,用于创建模型响应。 支持多轮对话、工具调用、推理等功能。
基本信息
| 项目 | 内容 |
|---|---|
| Base URL | https://www.yunzhuhub.cn |
| 标签 | OpenAI格式(Responses) |
| Operation ID | createResponse |
认证
- BearerAuth:使用 Bearer Token 认证。 格式:
Authorization: Bearer sk-xxxxxx
密钥安全
请只使用你自己的 API Key。示例中的 <YOUR_API_KEY> 必须在本地替换,不要把真实密钥提交到代码仓库或发送给他人。
参数
无额外路径或查询参数。
请求体
Content-Type: application/json
json
{
"title": "ResponsesRequest",
"type": "object",
"required": [
"model"
],
"properties": {
"model": {
"type": "string"
},
"input": {
"description": "输入内容,可以是字符串或消息数组",
"oneOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "object",
"properties": {}
}
}
]
},
"instructions": {
"type": "string"
},
"max_output_tokens": {
"type": "integer"
},
"temperature": {
"type": "number"
},
"top_p": {
"type": "number"
},
"stream": {
"type": "boolean"
},
"tools": {
"type": "array",
"items": {
"type": "object",
"properties": {}
}
},
"tool_choice": {
"oneOf": [
{
"type": "string"
},
{
"type": "object",
"properties": {}
}
]
},
"reasoning": {
"type": "object",
"properties": {
"effort": {
"type": "string",
"enum": [
"low",
"medium",
"high"
]
},
"summary": {
"type": "string"
}
}
},
"previous_response_id": {
"type": "string"
},
"truncation": {
"type": "string",
"enum": [
"auto",
"disabled"
]
}
}
}请求示例
以下示例只用于复制到本地终端,不会从文档站发送请求。
bash
curl --request POST 'https://www.yunzhuhub.cn/v1/responses' \
--header 'Authorization: Bearer <YOUR_API_KEY>' \
--header 'Content-Type: application/json' \
--data '<REQUEST_JSON>'响应
200 成功创建响应
json
{
"title": "ResponsesResponse",
"type": "object",
"properties": {
"id": {
"type": "string"
},
"object": {
"type": "string",
"example": "response"
},
"created_at": {
"type": "integer"
},
"status": {
"type": "string",
"enum": [
"completed",
"failed",
"in_progress",
"incomplete"
]
},
"model": {
"type": "string"
},
"output": {
"type": "array",
"items": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"id": {
"type": "string"
},
"status": {
"type": "string"
},
"role": {
"type": "string"
},
"content": {
"type": "array",
"items": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"text": {
"type": "string"
}
}
}
}
}
}
},
"usage": {
"$ref": "#/components/schemas/Usage"
}
}
}