*** title: Vercel AI SDK 'og:title': >- You.com + Vercel AI SDK | Web Search and Page Content retrieval for Vercel AI SDK Apps 'og:description': >- Add real-time web search and webpage content extraction to Vercel AI SDK applications. ------------- Integrate You.com's real-time web search and webpage content extraction capabilities into any application you've built with Vercel's AI SDK. The `@youdotcom-oss/ai-sdk-plugin` package provides two ready-made tools for the [Vercel AI SDK](https://sdk.vercel.ai/): 1. `youSearch()` for real-time web and news search 2. `youContents()` for page content extraction Drop them into any `generateText`, `streamText`, or `generateObject` call to give your AI application real-time web access. Starting from scratch? We recommend using Skills, so your agent can build this integration for you. [Learn how](/build-with-agents/skills) . *** ## Getting Started ### Install the package ```bash npm install @youdotcom-oss/ai-sdk-plugin ``` ### Set your API key ```bash export YDC_API_KEY=your_api_key ``` Get your API key at [you.com/platform/api-keys](https://you.com/platform/api-keys). *** ## Usage ### Web search with `youSearch` Use `youSearch()` to give a model access to structured real-time web and news results. ```typescript import { generateText, stepCountIs } from "ai"; import { youSearch } from "@youdotcom-oss/ai-sdk-plugin"; import { anthropic } from "@ai-sdk/anthropic"; const { text } = await generateText({ model: anthropic("claude-sonnet-4-5"), prompt: "What happened in San Francisco last week?", tools: { search: youSearch(), }, stopWhen: stepCountIs(3), }); console.log(text); ``` ### Content extraction with `youContents` Use `youContents()` when the model needs to retrieve entire web page content as HTML or markdown. ```typescript import { generateText, stepCountIs } from "ai"; import { youContents } from "@youdotcom-oss/ai-sdk-plugin"; import { anthropic } from "@ai-sdk/anthropic"; const { text } = await generateText({ model: anthropic("claude-sonnet-4-5"), prompt: "Summarize the content from vercel.com/blog", tools: { extract: youContents(), }, stopWhen: stepCountIs(3), }); console.log(text); ``` ### Combining both tools You can provide both tools at once and let the model decide which to use: ```typescript import { generateText, stepCountIs } from "ai"; import { youSearch, youContents } from "@youdotcom-oss/ai-sdk-plugin"; import { anthropic } from "@ai-sdk/anthropic"; const { text } = await generateText({ model: anthropic("claude-sonnet-4-5"), prompt: "Find recent blog posts about the Vercel AI SDK, then extract and summarize the top result.", tools: { search: youSearch(), extract: youContents(), }, stopWhen: stepCountIs(5), }); console.log(text); ``` ### Passing the API key explicitly If you prefer not to use environment variables, pass the key directly: ```typescript import { youSearch, youContents } from "@youdotcom-oss/ai-sdk-plugin"; const searchTool = youSearch({ apiKey: "your_api_key" }); const contentsTool = youContents({ apiKey: "your_api_key" }); ``` *** ## Resources Source code for the AI SDK plugin Official Vercel AI SDK documentation Full Search API parameters and response schema Full Contents API parameters and response schema