Mtu API-DOC
首页应用对话
首页应用对话
WeChat ID:F25F91
    • Mtu API简介
    • Model-Studio-Pricing模型列表价格
    • Model限时免费模型列表
    • 1206更新(接入纯搜索baidu接口)
    • 1204模型更新Mistral-Large-3(675B)
    • 1120模型更新Jina DeepSearch v1
    • 1119模型更新列表Gemini 3 API
    • 1116模型更新列表GPT-5.1系列
    • 1114模型更新列表
    • 1106模型更新列表
    • 1021模型更新列表
    • 1013模型更新列表
    • 1003模型更新列表
    • 0922模型更新列表
    • Migrate to the Responses API
    • GPT-5-codex API上线 0924更新
    • OpenAI Web search 网络搜索
    • Using tools OpenAI官方文档
    • Chat
      • Create chat completion
        POST
      • List chat completions
        GET
      • Get chat completion
        GET
      • Update chat completion metadata
        POST
      • Delete chat completion
        DELETE
      • Get chat messages
        GET
    • Images
      • Create image
        POST
      • Create image edit
        POST
      • Create image variation
        POST
    • Audio
      • Create speech
      • Create transcription
      • Create translation
    • Embeddings
      • Create embeddings
    • Moderations
      • Create moderation
    • Files
      • Upload file
      • List files
      • Retrieve file
      • Delete file
      • Retrieve file content
    • Models
      • List models
      • Retrieve model
      • Delete a fine-tuned model
    • MCP开发
      • MCP开始使用
        • 简介
        • 示例 Servers
        • 示例 Clients
        • 快速上手
          • 服务器开发
          • 客户端开发
          • Claude 桌面版开发
      • 教程
        • 使用 LLMs 构建 MCP
        • 调试 Debugging
        • 调试器 Inspector
      • 概念
        • 核心架构
        • 资源 Resources
        • 提示词 Prompts
        • 工具 Tools
        • 采样 Sampling
        • 根 Roots
        • 传输 Transports
      • 开发
        • 新计划
        • 规划
        • 贡献
    • OpenAI 项目
      • 介绍
      • 项目说明
      • 导言
      • 身份验证
      • 发出请求
      • 参数详情
      • 聊天(Chat)
        • Chat Completions 对象
        • Chat Completions 对象块
        • 创建 Chat Completions
      • 音频(Audio)
        • 创建语音
        • 创建转录
        • 创建翻译
      • 自动补全(Completions)
        • Completions 对象
        • 创建 Completions
      • 嵌入(Embeddings)
        • 嵌入对象
        • 创建嵌入
      • 微调(Fine-tuning)
        • 微调作业对象
        • 微调作业事件对象
        • 创建微调作业
        • 列出微调作业
        • 检索微调作业
        • 取消微调
        • 列出微调事件
      • 图像(Images)
        • README
        • 图像对象
        • 创建图像
        • 创建图片编辑
        • 创建图像变体
      • 模型(Models)
        • 模型对象
        • 列出模型
        • 检索模型
        • 删除微调模型
      • 文件(Files)
        • README
        • 文件对象
        • 列出文件
        • 上传文件
        • 删除文件
        • 检索文件
        • 检索文件内容
      • 审查(Moderations)
        • 调节对象
        • 创建内容审核
      • 助手测试版(AssistantsBeta)
        • 辅助对象
        • 辅助文件对象
        • 创建助手
        • 检索助手
        • 修改助手
        • 删除助手
        • 列出助手
        • 创建辅助文件
        • 检索助手文件
        • 删除辅助文件
        • 列出助手文件
      • 线程(Threads)
        • 线程对象
        • 创建线程
        • 检索线程
        • 修改线程
        • 删除话题
      • 留言(Messages)
        • 消息对象
        • 消息文件对象
        • 创建消息
        • 检索消息
        • 修改留言
        • 列出消息
        • 检索消息文件
        • 列出消息文件
      • 运行(Runs)
        • 运行对象
        • 运行步骤对象
        • 创建运行
        • 检索运行
        • 修改运行
        • 列表运行
        • 提交工具输出以运行
        • 取消运行
        • 创建线程并运行
        • 检索运行步骤
        • 列出运行步骤
      • 已弃用-音频(Audio)
        • 创建转录
        • 创建翻译
    • 通义千问 项目
      • 首次调用通义千问API
      • 文本生成
        • 深度思考(QwQ)
          • 深度思考(QwQ)概括
          • 快速开始
          • 多轮对话
        • 长上下文
          • 通过file-id传入文档信息
            • 简单示例
            • 传入多文档
            • 追加文档
          • 通过纯文本传入信息
            • 简单示例
            • 传入多文档
            • 追加文档
          • 通过JSON字符串传入文档信息
            • 简单示例
            • 传入多文档
            • 追加文档
        • 翻译能力
          • Qwen-MT模型
          • 支持的语言
          • 简单示例
          • 流式输出
          • 术语干预翻译
          • 使用翻译记忆
          • 领域提示
        • 数学能力
          • 模型概览
          • 示例代码
        • 代码能力
          • 模型概览
          • 简单示例
          • 代码补全
          • 根据前缀和后缀生成中间内容
        • 多轮对话
          • 开始使用
        • 流式输出(Stream)
          • 概述
          • 开始使用
        • 工具调用(Function Calling)
          • 概述
        • 结构化输出(Json Mode)
          • 支持的模型
          • 开始使用
        • 前缀续写(Partial Mode)
          • 支持的模型
          • 开始使用
        • 批量推理(Batch)
          • 概述
        • 上下文缓存(Context Cache)
          • 概述
      • 视觉理解
        • 全模态(Qwen-Omni )
          • 概述
          • 开始使用
          • 图片+文本输入
          • 音频+文本输入
          • 视频+文本输入
          • 多轮对话
    • Claude code 部署教程
      • Claude code 部署教程接入MTUAPI
      • Claude Code Router 配置指南
    • 数据模型
      • Schemas
        • ChatCompletionRequest
        • ChatCompletionObject
        • EmbeddingsRequest
        • ChatMessage
        • ImageCreateRequest
        • ModerationsRequest
        • FileObject

    OpenAI Web search 网络搜索

    Web search#

    Allow models to search the web for the latest information before generating a response.
    Web search allows models to access up-to-date information from the internet and provide answers with sourced citations. To enable this, use the web search tool in the Responses API or, in some cases, Chat Completions.
    There are three main types of web search available with OpenAI models:
    1.
    Non‑reasoning web search: The non-reasoning model sends the user’s query to the web search tool, which returns the response based on top results. There’s no internal planning and the model simply passes along the search tool’s responses. This method is fast and ideal for quick lookups.
    2.
    Agentic search with reasoning models is an approach where the model actively manages the search process. It can perform web searches as part of its chain of thought, analyze results, and decide whether to keep searching. This flexibility makes agentic search well suited to complex workflows, but it also means searches take longer than quick lookups. For example, you can adjust GPT-5’s reasoning level to change both the depth and latency of the search.
    3.
    Deep research is a specialized, agent-driven method for in-depth, extended investigations by reasoning models. The model conducts web searches as part of its chain of thought, often tapping into hundreds of sources. Deep research can run for several minutes and is best used with background mode. These tasks typically use models like o3-deep-research, o4-mini-deep-research, or gpt-5 with reasoning level set to high.
    Using the Responses API, you can enable web search by configuring it in the tools array in an API request to generate content. Like any other tool, the model can choose to search the web or not based on the content of the input prompt.
    Web search tool example

    Output and citations#

    Model responses that use the web search tool will include two parts:
    A web_search_call output item with the ID of the search call, along with the action taken in web_search_call.action. The action is one of:
    search, which represents a web search. It will usually (but not always) includes the search query and domains which were searched. Search actions incur a tool call cost (see pricing).
    open_page, which represents a page being opened. Supported in reasoning models.
    find_in_page, which represents searching within a page. Supported in reasoning models.
    A message output item containing:
    The text result in message.content[0].text
    Annotations message.content[0].annotations for the cited URLs
    By default, the model's response will include inline citations for URLs found in the web search results. In addition to this, the url_citation annotation object will contain the URL, title and location of the cited source.
    When displaying web results or information contained in web results to end users, inline citations must be made clearly visible and clickable in your user interface.
    [
        {
            "type": "web_search_call",
            "id": "ws_67c9fa0502748190b7dd390736892e100be649c1a5ff9609",
            "status": "completed"
        },
        {
            "id": "msg_67c9fa077e288190af08fdffda2e34f20be649c1a5ff9609",
            "type": "message",
            "status": "completed",
            "role": "assistant",
            "content": [
                {
                    "type": "output_text",
                    "text": "On March 6, 2025, several news...",
                    "annotations": [
                        {
                            "type": "url_citation",
                            "start_index": 2606,
                            "end_index": 2758,
                            "url": "https://...",
                            "title": "Title..."
                        }
                    ]
                }
            ]
        }
    ]

    Domain filtering#

    Domain filtering in web search lets you limit results to a specific set of domains. With the filters parameter you can set an allow-list of up to 20 URLs. When formatting URLs, omit the HTTP or HTTPS prefix. For example, use openai.com instead of https://openai.com/. This approach also includes subdomains in the search. Note that domain filtering is only available in the Responses API with the web_search tool.

    Sources#

    To view all URLs retrieved during a web search, use the sources field. Unlike inline citations, which show only the most relevant references, sources returns the complete list of URLs the model consulted when forming its response. The number of sources is often greater than the number of citations. Real-time third-party feeds are also surfaced here and are labeled as oai-sports, oai-weather, or oai-finance. The sources field is available with both the web_search and web_search_preview tools.
    List sources

    User location#

    To refine search results based on geography, you can specify an approximate user location using country, city, region, and/or timezone.
    The city and region fields are free text strings, like Minneapolis and Minnesota respectively.
    The country field is a two-letter ISO country code, like US.
    The timezone field is an IANA timezone like America/Chicago.
    Note that user location is not supported for deep research models using web search.
    Customizing user location

    API compatibility#

    Web search is available in the Responses API as the generally available version of the tool, web_search, as well as the earlier tool version, web_search_preview. To use web search in the Chat Completions API, use the specialized web search models gpt-5-search-api, gpt-4o-search-preview and gpt-4o-mini-search-preview.

    Limitations#

    Web search is currently not supported in gpt-5 with minimal reasoning, and gpt-4.1-nano.
    When used as a tool in the Responses API, web search has the same tiered rate limits as the models above.
    Web search is limited to a context window size of 128000 (even with gpt-4.1 and gpt-4.1-mini models).

    Usage notes#

    ||
    |ResponsesChat CompletionsAssistants|Same as tiered rate limits for underlying model used with the tool.|PricingZDR and data residency|

    扫码加入 Mtu api 微信交流群

    获得 Mtu api 使用上的任何帮助,效率得到大幅提升,技术客服WeChat:F25F91

    扫码关注公众号
    修改于 2025-11-18 05:49:56
    上一页
    GPT-5-codex API上线 0924更新
    下一页
    Using tools OpenAI官方文档
    Built with