创建模型响应(流式返回)
POST/v1/responses 创建模型响应(流式返回)
通过 Vortap 的 Responses 接口创建一次模型响应。该接口适用于仅支持 Responses 格式的模型,例如 o3-pro、codex-mini-latest。
接口地址
POST https://www.vortapapi.com/v1/responses
请求头
| 名称 | 必填 | 说明 |
|---|---|---|
Content-Type | 是 | 请求体格式,通常为 application/json |
Accept | 是 | 返回格式;流式响应可使用 text/event-stream |
Authorization | 否 | API 密钥认证,格式为 Bearer sk-*** |
请求示例
curl https://www.vortapapi.com/v1/responses \
-H "Content-Type: application/json" \
-H "Accept: text/event-stream" \
-H "Authorization: Bearer sk-***" \
-d '{
"model": "o3-pro",
"input": "Hello, how can you help me?",
"stream": true
}'
响应示例
当启用流式输出时,服务端会以事件流形式持续返回增量内容。不同模型和参数设置可能会影响实际返回字段。
{
"id": "chatcmpl-123",
"object": "chat.completion",
"created": 1677652288,
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "\n\nHello there, how may I assist you today?"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 9,
"completion_tokens": 12,
"total_tokens": 21
}
}