> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs-staging.you.com/llms.txt.
> For full documentation content, see https://docs-staging.you.com/llms-full.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs-staging.you.com/_mcp/server.

# Vercel AI SDK

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.

Starting from scratch? We recommend using Skills, so your agent can build this integration for you. [Learn how](/docs/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](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, isStepCount } 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: isStepCount(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, isStepCount } 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: isStepCount(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, isStepCount } 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: isStepCount(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, isStepCount } 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: isStepCount(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

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

Full Research API parameters and response schema