Skip to content

web搜索

POST https://az.gptplus5.com/v1/chat/completions

参考文档:https://platform.openai.com/docs/api-reference/chat/create

请求参数

Authorization

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

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

Header 参数

参数名类型必需说明示例
Authorizationstring必需Bearer $OPENAI_API_KEY
Content-typestring必需application/json

Body 参数 (application/json)

参数名类型必需说明
modelstring必需
web_search_optionsobject必需
messagesarray[object]必需
  └ rolestring可选
  └ contentstring可选

请求示例

json
{
        "model": "gpt-4o-search-preview",
        "web_search_options": {},
        "messages": [{
            "role": "user",
            "content": "What was a positive news story from today?"
        }]
    }

cURL 示例

bash
curl --location --request POST 'https://az.gptplus5.com/v1/chat/completions' \
--header 'Authorization: Bearer <token>' \
--header 'Content-type: application/json' \
--data-raw '{
        "model": "gpt-4o-search-preview",
        "web_search_options": {},
        "messages": [{
            "role": "user",
            "content": "What was a positive news story from today?"
        }]
    }'

返回响应

🟢200成功

响应示例

json
{}