Responses
POST /v1/responses 参考,这是兼容 OpenAI 的 Responses API,支持文本生成、工具、流式响应和按量计费。
创建模型响应。Responses API 是 Chat Completions 的替代方案,采用更简单的输入格式。
端点
POST https://api.leaper.one/v1/responses参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| model | string | 是 | 模型 ID。支持:"gpt-5-nano"、"gpt-5.4" |
| input | string | array | 是 | 用于生成响应的文本字符串或输入对象数组 |
| stream | boolean | 否 | 为 true 时通过 SSE 返回增量内容。默认:false |
请求
curl -X POST https://api.leaper.one/v1/responses \
-H "Authorization: Bearer sk-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5-nano",
"input": "What is LEAPERone?"
}'响应
{
"id": "resp-abc123",
"object": "response",
"created_at": 1700000000,
"model": "gpt-5-nano",
"output": [
{
"type": "message",
"role": "assistant",
"content": [
{
"type": "output_text",
"text": "LEAPERone is a unified AI API gateway that gives you access to multiple AI models through a single API key."
}
]
}
],
"usage": {
"input_tokens": 12,
"output_tokens": 22,
"total_tokens": 34
}
}