OpenAI Response¶
OpenAI Response API 提供了一套完整的接口来管理模型响应,包括创建、获取、删除和取消响应。
创建模型响应¶
Creates a model response.
Authorizations¶
| 参数 | 类型 | 位置 | 必填 | 说明 |
|---|---|---|---|---|
| Authorization | string | header | 是 | 身份验证标头格式为 Bearer <API_KEY>,其中 <API_KEY> 是您的API令牌。 |
Body¶
application/json
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| model | string | 是 | 模型名称。例如:"gpt-4.1" |
| input | string | 是 | 消息内容。例如:"Hello, how are you?" |
| stream | boolean | 否 | 是否流式返回。默认:false |
Response¶
200 - Model response¶
响应包含完整的响应对象,包括生成的内容、使用统计等信息。
请求示例¶
curl --request POST \
--url https://cdn.12ai.org/v1/responses \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "gpt-4.1",
"input": "Hello, how are you?",
"stream": false
}'
响应示例¶
{
"id": "resp_08673d0bc9faf170006904e93a59a88193b6f5989496408e60",
"object": "response",
"created_at": 1761929530,
"status": "completed",
"background": false,
"model": "gpt-4.1",
"output": [
{
"id": "msg_08673d0bc9faf170006904e93aab748193a6aa00c376e35a19",
"type": "message",
"status": "completed",
"content": [
{
"type": "output_text",
"annotations": [],
"logprobs": [],
"text": "Once upon a time, a gentle unicorn named Luna wandered into a glowing, moonlit meadow..."
}
],
"role": "assistant"
}
],
"parallel_tool_calls": true,
"service_tier": "default",
"temperature": 1,
"tool_choice": "auto",
"tools": [],
"top_p": 1,
"truncation": "disabled",
"usage": {
"input_tokens": 18,
"input_tokens_details": {
"cached_tokens": 0
},
"output_tokens": 69,
"output_tokens_details": {
"reasoning_tokens": 0
},
"total_tokens": 87
},
"metadata": {}
}
获取模型响应¶
Gets a model response.
Authorizations¶
| 参数 | 类型 | 位置 | 必填 | 说明 |
|---|---|---|---|---|
| Authorization | string | header | 是 | 身份验证标头格式为 Bearer <API_KEY>,其中 <API_KEY> 是您的API令牌。 |
Path Parameters¶
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| response_id | string | 是 | 响应ID |
Response¶
200 - Model response¶
返回指定ID的响应对象,结构与创建响应的返回值相同。
请求示例¶
curl --request GET \
--url https://cdn.12ai.org/v1/responses/resp_08673d0bc9faf170006904e93a59a88193b6f5989496408e60 \
--header 'Authorization: Bearer <token>'
响应示例¶
{
"id": "resp_08673d0bc9faf170006904e93a59a88193b6f5989496408e60",
"object": "response",
"created_at": 1761929530,
"status": "completed",
"model": "gpt-4.1",
"output": [
{
"id": "msg_08673d0bc9faf170006904e93aab748193a6aa00c376e35a19",
"type": "message",
"status": "completed",
"content": [
{
"type": "output_text",
"text": "..."
}
],
"role": "assistant"
}
],
"usage": {
"input_tokens": 18,
"output_tokens": 69,
"total_tokens": 87
}
}
删除模型响应¶
Deletes a model response.
Authorizations¶
| 参数 | 类型 | 位置 | 必填 | 说明 |
|---|---|---|---|---|
| Authorization | string | header | 是 | 身份验证标头格式为 Bearer <API_KEY>,其中 <API_KEY> 是您的API令牌。 |
Path Parameters¶
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| response_id | string | 是 | 响应ID |
Response¶
删除成功后无响应体返回。
请求示例¶
curl --request DELETE \
--url https://cdn.12ai.org/v1/responses/resp_08673d0bc9faf170006904e93a59a88193b6f5989496408e60 \
--header 'Authorization: Bearer <token>'
取消模型响应¶
Cancels a model response.
Authorizations¶
| 参数 | 类型 | 位置 | 必填 | 说明 |
|---|---|---|---|---|
| Authorization | string | header | 是 | 身份验证标头格式为 Bearer <API_KEY>,其中 <API_KEY> 是您的API令牌。 |
Path Parameters¶
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| response_id | string | 是 | 响应ID |
Response¶
取消成功后无响应体返回。