主题
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 参数
| 参数名 | 类型 | 必需 | 说明 | 示例 |
|---|---|---|---|---|
Authorization | string | 必需 | Bearer $OPENAI_API_KEY | |
Content-type | string | 必需 | application/json |
Body 参数 (application/json)
| 参数名 | 类型 | 必需 | 说明 |
|---|---|---|---|
model | string | 必需 | |
web_search_options | object | 必需 | |
messages | array[object] | 必需 | |
└ role | string | 可选 | |
└ content | string | 可选 |
请求示例
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
{}