创建函数调用
POST /v1/responses
说明
https://platform.openai.com/docs/api-reference/responses/create 部分OpenAI模型仅支持Response格式,例如o3-pro,codex-mini-latest
概览
| Method | POST |
|---|---|
| Path | /v1/responses |
| Type | http |
| Status | 1 |
| Module | 2102810 |
| Folder | 62503105 |
参数
{ "query": [], "path": [], "cookie": [], "header": [ { "id": "NQs7bxnpZf", "name": "Content-Type", "required": true, "description": "", "type": "string", "enable": true, "sampleValue": "application/json" }, { "id": "qb8tEQbCty", "name": "Accept", "required": true, "description": "", "type": "string", "enable": true, "sampleValue": "application/json" }, { "required": false, "description": "", "type": "string", "id": "gBxcCbXhsa", "enable": true, "name": "Authorization", "sampleValue": "Bearer {{YOUR_API_KEY}}" } ] }
请求体
{ "type": "application/json", "parameters": [], "jsonSchema": { "type": "object", "properties": { "model": { "type": "string", "description": "要使用的模型的 ID。有关哪些模型可与聊天 API 一起使用的详细信息,请参阅模型端点兼容性表。" }, "input": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string" }, "content": { "type": "string" } }, "x-apifox-orders": [ "role", "content" ] } } }, "x-apifox-orders": [ "model", "input" ] }, "mediaType": "", "examples": [ { "value": "\t\n{\n \"input\": [\n {\n \"role\": \"user\",\n \"content\": \"请同时帮我做以下几件事:\\n1. 获取当前系统时间\\n2. 查看系统信息(操作系统、内存等)\\n3. 帮我计算 123.5 + 456.7 的结果\\n4. 生成3个1-100之间的随机数\\n\\n这是一个并行工具调用测试,请同时执行这些任务。\"\n }\n ],\n \"metadata\": {\n \"model_id\": \"32\"\n },\n \"model\": \"gpt-4.1\",\n \n \"tool_choice\": \"auto\",\n \"tools\": [\n {\n \"type\": \"function\",\n \"name\": \"random_generator\",\n \"description\": \"生成指定范围内的随机数,支持批量生成\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"min\": {\n \"description\": \"最小值(默认1)\",\n \"type\": \"integer\"\n },\n \"max\": {\n \"description\": \"最大值(默认100)\",\n \"type\": \"integer\"\n },\n \"count\": {\n \"description\": \"生成数量(默认1,最大10)\",\n \"type\": \"integer\"\n }\n }\n }\n },\n {\n \"type\": \"function\",\n \"name\": \"system_info\",\n \"description\": \"获取当前系统的基本信息,包括操作系统、Java版本、内存使用情况等\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {}\n }\n },\n {\n \"type\": \"function\",\n \"name\": \"math_calculator\",\n \"description\": \"执行基本数学运算,支持加减乘除和幂运算\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"a\": {\n \"description\": \"第一个数字\",\n \"type\": \"number\"\n },\n \"b\": {\n \"description\": \"第二个数字\",\n \"type\": \"number\"\n },\n \"operation\": {\n \"description\": \"运算类型: add, subtract, multiply, divide, power\",\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"operation\",\n \"a\",\n \"b\"\n ]\n }\n },\n {\n \"type\": \"function\",\n \"name\": \"current_time\",\n \"description\": \"获取当前系统时间\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {}\n }\n }\n ]\n}", "mediaType": "application/json" } ], "oasExtensions": "" }
响应
[ { "id": 750548727, "name": "OK", "code": 200, "contentType": "json", "jsonSchema": { "type": "object", "properties": { "id": { "type": "string" }, "object": { "type": "string" }, "created": { "type": "integer" }, "choices": { "type": "array", "items": { "type": "object", "properties": { "index": { "type": "integer" }, "message": { "type": "object", "properties": { "role": { "type": "string" }, "content": { "type": "string" } }, "required": [ "role", "content" ], "x-apifox-orders": [ "role", "content" ] }, "finish_reason": { "type": "string" } }, "x-apifox-orders": [ "index", "message", "finish_reason" ] } }, "usage": { "type": "object", "properties": { "prompt_tokens": { "type": "integer" }, "completion_tokens": { "type": "integer" }, "total_tokens": { "type": "integer" } }, "required": [ "prompt_tokens", "completion_tokens", "total_tokens" ], "x-apifox-orders": [ "prompt_tokens", "completion_tokens", "total_tokens" ] } }, "required": [ "id", "object", "created", "choices", "usage" ], "x-apifox-orders": [ "id", "object", "created", "choices", "usage" ] }, "itemSchema": {}, "description": "", "mediaType": "", "headers": [], "oasExtensions": "" } ]
响应示例
[ { "name": "成功示例", "responseId": 750548727, "data": "{\n \"id\": \"resp_68ac1558e9488190bcc2cbb94c7d7a140b8064b15a091a77\",\n \"object\": \"response\",\n \"created_at\": 1756108120,\n \"status\": \"completed\",\n \"background\": false,\n \"content_filters\": null,\n \"error\": null,\n \"incomplete_details\": null,\n \"instructions\": null,\n \"max_output_tokens\": null,\n \"max_tool_calls\": null,\n \"model\": \"gpt-4.1-data\",\n \"output\": [\n {\n \"id\": \"fc_68ac15594be88190a58217f75a6a54cc0b8064b15a091a77\",\n \"type\": \"function_call\",\n \"status\": \"completed\",\n \"arguments\": \"{\\\"sign\\\":\\\"Aquarius\\\"}\",\n \"call_id\": \"call_6kbB2GTk62PPUNdGuBJPx9KQ\",\n \"name\": \"get_horoscope\"\n }\n ],\n \"parallel_tool_calls\": true,\n \"previous_response_id\": null,\n \"prompt_cache_key\": null,\n \"reasoning\": {\n \"effort\": null,\n \"summary\": null\n },\n \"safety_identifier\": null,\n \"service_tier\": \"default\",\n \"store\": true,\n \"temperature\": 1.0,\n \"text\": {\n \"format\": {\n \"type\": \"text\"\n }\n },\n \"tool_choice\": \"auto\",\n \"tools\": [\n {\n \"type\": \"function\",\n \"description\": \"Get today's horoscope for an astrological sign.\",\n \"name\": \"get_horoscope\",\n \"parameters\": {\n \"properties\": {\n \"sign\": {\n \"description\": \"An astrological sign like Taurus or Aquarius\",\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"sign\"\n ],\n \"type\": \"object\"\n },\n \"strict\": true\n }\n ],\n \"top_p\": 1.0,\n \"truncation\": \"disabled\",\n \"usage\": {\n \"input_tokens\": 62,\n \"input_tokens_details\": {\n \"cached_tokens\": 0\n },\n \"output_tokens\": 18,\n \"output_tokens_details\": {\n \"reasoning_tokens\": 0\n },\n \"total_tokens\": 80\n },\n \"user\": null,\n \"metadata\": {}\n}", "description": "", "oasKey": "", "oasExtensions": "", "id": 670136793 } ]