curl https://api.wenwen-ai.com/v1/responses \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "gpt-4.1",
"input": "Hello! How can you help me today?",
"instructions": "You are a helpful assistant."
}'{
"id": "resp_6884fcab4930819dbbc02f15cbe63f6c0a92c38ff214d10a",
"object": "response",
"created_at": 1753545899,
"status": "completed",
"background": false,
"error": null,
"incomplete_details": null,
"instructions": "You are a helpful assistant.",
"max_output_tokens": null,
"max_tool_calls": null,
"model": "gpt-4.1-2025-04-14",
"output": [
{
"id": "msg_6884fcab8f18819dbcdf349f01b424f80a92c38ff214d10a",
"type": "message",
"status": "completed",
"content": [
{
"type": "output_text",
"annotations": [],
"logprobs": [],
"text": "Hello! How can I assist you today?"
}
],
"role": "assistant"
}
],
"parallel_tool_calls": true,
"previous_response_id": null,
"prompt_cache_key": null,
"reasoning": {
"effort": null,
"summary": null
},
"safety_identifier": null,
"service_tier": "default",
"store": true,
"temperature": 1.0,
"text": {
"format": {
"type": "text"
}
},
"tool_choice": "auto",
"tools": [],
"top_logprobs": 0,
"top_p": 1.0,
"truncation": "disabled",
"usage": {
"input_tokens": 19,
"input_tokens_details": {
"cached_tokens": 0
},
"output_tokens": 10,
"output_tokens_details": {
"reasoning_tokens": 0
},
"total_tokens": 29
},
"user": null,
"metadata": {}
}| 参数 | 类型 | 说明 |
|---|---|---|
| model | string | 模型名称,如 gpt-4.1, o3 |
| input | string | 用户输入内容 |
| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| instructions | string | null | 系统指令,定义助手行为 |
| previous_response_id | string | null | 上一个响应的 ID,用于维护上下文 |
| temperature | float | 1.0 | 控制输出随机性 (0-2) |
| max_output_tokens | int | null | 最大输出令牌数 |
| tools | array | [] | 可用工具列表 |
| tool_choice | string | "auto" | 工具选择策略 |
| parallel_tool_calls | boolean | true | 是否允许并行工具调用 |
| store | boolean | true | 是否存储对话用于训练 |
| metadata | object | {} | 自定义元数据 |
| 特性 | Chat Completions | Responses API |
|---|---|---|
| 基础对话 | ✅ 支持 | ✅ 支持 |
| 流式响应 | ✅ 支持 | ✅ 支持 |
| 函数调用 | ✅ 支持 | ✅ 增强支持 |
| 内置工具 | ❌ 不支持 | ✅ 丰富工具 |
| 状态管理 | ❌ 无状态 | ✅ 有状态 |
| 推理保持 | ❌ 不支持 | ✅ O3/O4支持 |
| 文件搜索 | ❌ 不支持 | ✅ 支持 |
| 代码解释器 | ❌ 不支持 | ✅ 支持 |
| 字段 | 类型 | 说明 |
|---|---|---|
| id | string | 响应唯一标识符 |
| object | string | 固定为 "response" |
| created_at | integer | 创建时间戳 |
| status | string | 状态:completed/failed/in_progress |
| model | string | 实际使用的模型版本 |
| output | array | 输出消息数组 |
| usage | object | Token 使用统计 |
{
"id": "msg_xxx",
"type": "message",
"status": "completed",
"content": [
{
"type": "output_text",
"text": "响应内容",
"annotations": [],
"logprobs": []
}
],
"role": "assistant"
}{
"usage": {
"input_tokens": 19,
"input_tokens_details": {
"cached_tokens": 0
},
"output_tokens": 10,
"output_tokens_details": {
"reasoning_tokens": 0 // 仅推理模型
},
"total_tokens": 29
}
}{
"error": {
"type": "invalid_request_error",
"code": "model_not_supported",
"message": "The model 'gpt-3.5-turbo' is not supported for the responses endpoint.",
"param": "model"
}
}| 错误码 | 说明 | 解决方案 |
|---|---|---|
| model_not_supported | 模型不支持 Responses API | 使用支持的新模型 |
| invalid_previous_response_id | 无效的上一个响应ID | 检查响应ID是否正确 |
| tool_not_available | 工具不可用 | 检查工具配置 |
| max_tokens_exceeded | 超出令牌限制 | 减少输入或设置max_output_tokens |