Skip to content

创建网络搜索

POST https://az.gptplus5.com/v1/responses

https://platform.openai.com/docs/api-reference/responses/create
部分OpenAI模型仅支持Response格式,例如o3-pro,codex-mini-latest

请求参数

Authorization

在 Header 添加参数Authorization,其值为在 Bearer 之后拼接 Token

示例:Authorization: Bearer ********************

Header 参数

参数名类型必需说明示例
Content-Typestring必需application/json
Acceptstring必需application/json
Authorizationstring可选Bearer {{YOUR_API_KEY}}

Body 参数 (application/json)

参数名类型必需说明
modelstring可选
toolsarray[object]可选模型在生成响应时可能调用的工具数组。
  └ typestring必需网络搜索工具的类型。web_search_preview或web_search_preview_2025_03_11。
inputstring可选

请求示例

json
{
  "model": "gpt-4.1-2025-04-14",
  "tools": [
    {
      "type": "web_search_preview"
    }
  ],
  "input": "what was a positive news story from today?"
}

cURL 示例

bash
curl --location --request POST 'https://az.gptplus5.com/v1/responses' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data-raw '{
  "model": "gpt-4.1-2025-04-14",
  "tools": [
    {
      "type": "web_search_preview"
    }
  ],
  "input": "what was a positive news story from today?"
}'

返回响应

🟢200OK

响应 Body

参数名类型必需说明
idstring必需
objectstring必需
createdinteger必需
choicesarray[object]必需
  └ indexinteger可选
  └ messageobject可选
  └ finish_reasonstring可选
usageobject必需
  └ prompt_tokensinteger必需
  └ completion_tokensinteger必需
  └ total_tokensinteger必需

响应示例

json
{
    "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
    }
}