我们可以通过 OpenAI 内置的联网工具 web_search_preview_2025_03_11 实现联网查询生成响应的功能,以下是联网响应的请求示例:

curl --location --request POST 'https://geekai.co/api/v1/responses' \
--header 'Authorization: Bearer {YOUR_GEEKAI_API_KEY}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "model": "gpt-4o-mini",
    "input": "2025年票房最高的电影?",
    "tools": [
        {
            "type": "web_search_preview_2025_03_11",
            "search_context_size": "low"
        }
    ]
}'

search_context_size 参数可以设置为 low, medium, high 来控制搜索上下文的大小。