***

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.
---------------------

For clean Markdown of any page, append .md to the page URL. For a complete documentation index, see https://you.com/docs/integrations/llms.txt. For full documentation content, see https://you.com/docs/integrations/llms-full.txt.

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 three 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
3. `youResearch()` for comprehensive web research with citations

Drop all three into any `generateText`, `streamText`, or `generateObject` call to give your AI application real-time web access.

<Launch>
  Starting from scratch? We recommend using Skills, so your agent can build this integration for you. 

  [Learn how](/docs/build-with-agents/skills)

  .
</Launch>

***

## Getting Started

### Install the package

```bash
npm install @youdotcom-oss/ai-sdk-plugin
```

### Set your API key

```bash
export api_key=api_key
```

Get your API key at [you.com/platform](https://you.com/platform).

***

## 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);
```

### Research with `youResearch`

Use `youResearch()` when the model needs comprehensive, synthesized answers with inline citations. The Research API supports effort levels (`lite`, `standard`, `deep`, `exhaustive`) to balance speed against thoroughness—the model selects the appropriate level automatically.

```typescript
import { generateText, stepCountIs } from "ai";
import { youResearch } from "@youdotcom-oss/ai-sdk-plugin";
import { anthropic } from "@ai-sdk/anthropic";

const { text } = await generateText({
  model: anthropic("claude-sonnet-4-5"),
  prompt: "What are the tradeoffs between WebSockets and Server-Sent Events for real-time applications?",
  tools: {
    research: youResearch(),
  },
  stopWhen: stepCountIs(3),
});

console.log(text);
```

### Combining all three tools

You can provide all three tools at once and let the model decide which to use:

```typescript
import { generateText, stepCountIs } from "ai";
import { youSearch, youContents, youResearch } 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(),
    research: youResearch(),
  },
  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, youResearch } from "@youdotcom-oss/ai-sdk-plugin";

const searchTool = youSearch({ apiKey: "api_key" });
const contentsTool = youContents({ apiKey: "api_key" });
const researchTool = youResearch({ apiKey: "api_key" });
```

***

## Resources

<CardGroup cols={2}>
  <Card title="GitHub Repository" icon="fa-brands fa-github" href="https://github.com/youdotcom-oss/dx-toolkit/tree/main/packages/ai-sdk-plugin">
    Source code for the AI SDK plugin
  </Card>

  <Card title="Vercel AI SDK Docs" icon="fa-regular fa-book" href="https://sdk.vercel.ai/">
    Official Vercel AI SDK documentation
  </Card>

  <Card title="Search API Reference" icon="fa-regular fa-magnifying-glass" href="/docs/api-reference/search/v1-search">
    Full Search API parameters and response schema
  </Card>

  <Card title="Contents API Reference" icon="fa-regular fa-file-lines" href="/docs/api-reference/contents">
    Full Contents API parameters and response schema
  </Card>

  <Card title="Research API Reference" icon="fa-regular fa-flask" href="/docs/api-reference/research/v1-research">
    Full Research API parameters and response schema
  </Card>
</CardGroup>