# Vercel

> Give Vercel AI SDK agents web search and full-page reading from one package, or call Search1API through Vercel Connect without storing an API key.

Canonical URL: https://s1.dev/docs/integrations/vercel

What Search1API adds to a Vercel app:

- **Search and read with one API.** Your agent searches Google, Reddit, GitHub, YouTube, arXiv, and more, reads the full page behind a result, and cites the URLs it used. No second scraping service is needed.
- **The content, not the page around it.** [Dedicated site parsers](https://s1.dev/docs/guides/site-parsers) for Reddit, GitHub, YouTube, and other sites return the post with its comments, the repository README, or the video transcript instead of navigation and ads.
- **No API key to manage.** With Vercel Connect, the user authorizes their Search1API account and your code requests a token at runtime.

Search1API offers two Vercel integrations: an **AI SDK tools package** and a **Vercel Connect connector**.

## Choose an integration

| | AI SDK tools | Vercel Connect |
| --- | --- | --- |
| Purpose | Add search, news, page reading, and agentic search to an AI SDK agent | Retrieve Search1API credentials at runtime |
| Package | `@search1api/ai-sdk` | `@vercel/connect` |
| Authentication | Your Search1API API key on the server | A Search1API account authorized through Connect |
| Where it runs | Compatible server-side JavaScript runtimes, including Next.js | Vercel projects linked to the connector |

Choose the tools package for `generateText` or `streamText` workflows. Choose Connect to manage access to a user's Search1API account through Vercel.

## AI SDK tools

Install the tools package:

```bash
npm install @search1api/ai-sdk ai zod
export SEARCH1API_API_KEY="your-api-key"
```

Pass `search1apiTools()` to your AI SDK call's `tools` option. It exposes `search`, `news`, `crawl`, and `ask`; you can choose which tools to include and set search parameters in application code.

The [AI SDK guide](https://s1.dev/docs/integrations/vercel-ai-sdk) covers tool calling, streaming, configuration, and error handling. A complete [Next.js example](https://github.com/superagents-lab/search1api-ai-sdk/tree/main/examples/nextjs) is available in the organization's repository. Configure your model provider's credentials separately from your Search1API API key.

## Vercel Connect

Open [Search1API on Vercel Connect](https://vercel.com/connect/search1api) to create a connector, or run these commands from your consuming project with an authenticated Vercel CLI:

```bash
npm install @vercel/connect
vercel link
vercel connect create search1api --name acme-search1api
vercel env pull
```

Complete the account authorization and enable the connection for the project's target environment. Request a token in server-side code:

```ts
import { getToken } from '@vercel/connect';

// Pass the signed-in user's ID from your server-side authentication.
export async function searchForUser(userId: string, query: string) {
  const token = await getToken('search1api/acme-search1api', {
    subject: { type: 'user', id: userId },
  });

  const response = await fetch('https://api.search1api.com/search', {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${token}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({ query, max_results: 5, crawl_results: 0 }),
  });

  if (!response.ok) throw new Error(`Search1API returned ${response.status}`);
  return response.json();
}
```

`getToken` returns a credential string. Keep it on the server and use it when calling Search1API. Replace `acme-search1api` with your connector's name. See the [Connect quickstart](https://vercel.com/docs/connect/quickstart) for setup and the [SDK reference](https://vercel.com/docs/connect/ts-sdk-reference) for user authorization and token errors.

Connect manages runtime credentials. The AI SDK package provides tool schemas and execution. If you need additional API capabilities such as sitemap discovery, see the [REST API reference](https://s1.dev/api).

## Verify your setup

- **AI SDK tools:** ask your agent to search for a topic and read a result. Check that it calls the expected tools and returns source URLs.
- **Connect:** request a token for an authorized user from the linked project and environment. If authorization is required, complete the user's connection before retrying.

## Billing

Search1API requests use the credentials' Search1API account credits. See [Credits and limits](https://s1.dev/docs/essentials/credits-and-limits). Model usage and Vercel services follow their respective providers' billing.

## Resources

- [AI SDK tools guide](https://s1.dev/docs/integrations/vercel-ai-sdk)
- [Search1API on Vercel Connect](https://vercel.com/connect/search1api)
- [Tools package on npm](https://www.npmjs.com/package/@search1api/ai-sdk)
- [Tools package source](https://github.com/superagents-lab/search1api-ai-sdk)