published fresh until

Vercel AI Gateway: add DeepSeek Search and Fetch

Summary Register both web retrieval helpers with one Gateway key, inspect tool failures and keep retrieval when changing models with AI SDK 6.0.321

Not for AI SDK 6 to 7 migration; see ai-sdk-6-to-7-migration-breaking-apis-and-provider-packages

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Do first: in an existing AI SDK 6 project, run pnpm add ai@6.0.321 and configure AI_GATEWAY_API_KEY in your server environment (minimum-version announcement, 6.0.321 package release).

If your agent can generate an answer but needs current pages to support it, register DeepSeek Search for discovery and DeepSeek Fetch for Markdown page retrieval. Vercel announced this Gateway integration on November 6, 2026 (changelog).

What changed

  • Any model with tool calling can use the helpers through one AI Gateway key; a separate DeepSeek account is unnecessary (announcement).
  • The documented minimums are AI SDK 6.0.321 on v6 or 7.0.160 on v7. Choose the version within your application's existing major line (announcement).

Register search and page reading

Adapt the official registration example:

import { gateway, streamText } from 'ai';

const result = streamText({
  model: 'deepseek/deepseek-v4.1-flash-1017',
  prompt: 'Find the Vercel AI Gateway documentation, read a page, and cite its URL.',
  tools: {
    deepseek_search: gateway.tools.deepseekSearch({ count: 3 }),
    deepseek_fetch: gateway.tools.deepseekFetch(),
  },
});

for await (const part of result.fullStream) {
  if (part.type === 'text-delta') process.stdout.write(part.text);
  else if (part.type === 'tool-error') console.error('The page could not be fetched.');
}

Inspect tool-error events while evaluating it; successful text alone does not show that page retrieval succeeded. The Gateway guide documents these failures and fullStream handling. If you already have a known page, pin it with gateway.tools.deepseekFetch({ url: 'https://vercel.com/docs/ai-gateway' }) instead of asking the model to choose a URL.

Cost and execution limits

ChoiceConsequence
Search versus FetchEach costs $0.75 per 1,000 billable requests; successful nonempty results/content trigger billing.
count: 3Changes search result count, not the per-request tool price.
Tool failure, timeout or empty resultNo tool charge; host-model tokens remain separately billed.

See request billing and parameters. If you import Gateway separately, its documented floors are @ai-sdk/gateway 3.0.227 with AI SDK 6 or 4.0.133 with AI SDK 7 (Search guide).

Evidence and limits

StackGrade's November 6 release digest separately records the integration; it is release reporting.

Adding alternative search tools and asking the model to try them in order gives best-effort fallback, not guaranteed ordering or retry counts (Vercel announcement). Fetch supports Markdown and depends on the target site's availability and policies (Fetch guide). This recipe adds retrieval within an existing SDK major; earlier API migrations remain outside its scope.

Not for: AI SDK 6 to 7 migration; see ai-sdk-6-to-7-migration-breaking-apis-and-provider-packages.

Started from a post by @Vercel / Jerilyn Zheng and Zachary Chen, packaged by the editor. Original post

Subjects

More in agent workflows

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Vercel AI Gateway: add DeepSeek Search and Fetch
Summary: Register both web retrieval helpers with one Gateway key, inspect tool failures and keep retrieval when changing models with `AI SDK 6.0.321`
Copy for agent
get the whatworks thread vercel-ai-gateway-deepseek-search-fetch-tools and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread vercel-ai-gateway-deepseek-search-fetch-tools
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp for anonymous reading; sign in via OAuth only to report a trial. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp