Newshot
Account

AI Gateway 新增 DeepSeek 搜索与抓取工具

AI summary

AI Gateway 现已提供 DeepSeek Search 和 DeepSeek Fetch 两个工具,前者返回相关页面的标题、URL 和摘要,后者将页面内容转为 Markdown 供模型读取。任何支持工具调用的模型都能用同一个 AI Gateway API 密钥使用这两个工具,无需单独的 DeepSeek 账号,切换模型提供商时工具保持不变。两项工具按每 1000 次计费请求 0.75 美元收费,失败、超时和空结果不计费。

Translation(model translation, not the source's own text)
题图
题图

DeepSeek Search 和 DeepSeek Fetch 现在可通过 AI Gateway 使用。Search 会查找相关页面,并返回标题、URL 和摘要。Fetch 会以 Markdown 形式获取页面内容,供你的模型读取。

只需一个 AI Gateway API key,即可在任何支持工具调用的模型上使用这两个工具。无需单独的 DeepSeek 账号,切换模型提供商时也可以保留相同的工具。

这些辅助工具在 v6 上需要 AI SDK 6.0.321 及更高版本,在 v7 上需要 7.0.160 及更高版本。使用 pnpm add ai@latest 更新,并设置你的 AI_GATEWAY_API_KEY。要组合使用搜索和页面抓取,请在 tools 中传入这两个辅助工具:


        import { gateway, streamText } from 'ai';const result = streamText({  model: 'deepseek/deepseek-v4.1-flash-1017',  prompt: 'Find the latest Vercel AI Gateway announcement, fetch it, and summarize it.',  tools: {    deepseek_search: gateway.tools.deepseekSearch({ count: 3 }),    deepseek_fetch: gateway.tools.deepseekFetch(),  },});for await (const text of result.textStream) {  process.stdout.write(text);}
      

如果 DeepSeek Search 失败,你也可以将其他搜索工具与 DeepSeek Fetch 搭配使用:


        import { gateway, streamText } from 'ai';const result = streamText({  model: 'zai/glm-5.3-flash',  system: 'Try deepseek_search, then exa_search, then parallel_search on errors. After search succeeds, use deepseek_fetch on a result URL.',  prompt: 'Find the latest Vercel AI Gateway announcement, fetch it, and summarize it.',  toolChoice: 'required',  tools: {    deepseek_search: gateway.tools.deepseekSearch({ count: 3 }),    deepseek_fetch: gateway.tools.deepseekFetch(),    exa_search: gateway.tools.exaSearch({ numResults: 3 }),    parallel_search: gateway.tools.parallelSearch({ maxResults: 3 }),  },});for await (const text of result.textStream) {  process.stdout.write(text);}
      

搜索回退由模型主导,因此提供商顺序和重试次数均为尽力而为。DeepSeek Fetch 可以抓取上述任一搜索工具返回的结果 URL。

Search 和 Fetch 各按每 1,000 次计费请求 $0.75 收费。失败请求、超时和空结果不收取工具费用。模型 token 另行计费。

有关配置选项和定价详情,请参阅 DeepSeek Search 文档和 DeepSeek Fetch 文档。

AI Gateway 提供一个 API,用于调用模型、跟踪用量与成本,以及配置路由、重试和故障转移。你可以使用 AI Gateway API key,或自带提供商密钥。

The translation is machine-generated and individual terms may be off. Nothing is rewritten or cut; the original is authoritative.

Published by Vercel Blog
This site only summarises and aggregates; copyright stays with the original author. Headlines and summaries follow the source — where they differ, the original wins.
Read the original ↗