跳转到主要内容
POST
/
v1
/
responses
curl --request POST \
  --url https://api.foxapi.cc/v1/responses \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "gpt-4o",
  "input": "解释一下 RESTful API 的设计原则"
}
'
{
  "id": "resp_abc123",
  "object": "response",
  "created_at": 1757165031,
  "model": "<string>",
  "status": "completed",
  "output": [
    {
      "type": "message",
      "id": "msg_abc123",
      "role": "assistant",
      "content": [
        {
          "type": "output_text",
          "text": "Hello! How can I help you today?"
        }
      ]
    }
  ],
  "usage": {
    "input_tokens": 20,
    "output_tokens": 50,
    "total_tokens": 70
  }
}

授权

Authorization
string
header
必填

所有接口均需要使用Bearer Token进行认证

使用时在请求头中添加:

Authorization: Bearer YOUR_API_KEY

请求体

application/json
model
string
必填

模型名称

示例:

"gpt-4o"

input
必填

用于生成响应的文本输入或消息列表

stream
boolean
默认值:false

是否流式返回响应

temperature
number

采样温度 (0-2)

必填范围: 0 <= x <= 2
max_output_tokens
integer

最大输出token生成数

top_p
number

核采样参数 (0-1)

必填范围: 0 <= x <= 1
previous_response_id
string

上一个响应的ID,用于多轮对话

instructions
string

系统级指令

tools
object[]

可用工具列表

text
object

文本输出格式配置

响应

响应对象

id
string

响应唯一ID

示例:

"resp_abc123"

object
enum<string>

对象类型

可用选项:
response
created_at
integer

创建时间戳

示例:

1757165031

model
string

使用的模型

status
enum<string>

响应状态

可用选项:
completed,
failed,
in_progress,
incomplete
示例:

"completed"

output
object[]

响应输出内容列表

usage
object

用量统计