> ## Documentation Index
> Fetch the complete documentation index at: https://cloro.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Vercel AI SDK

> Use the @cloro-dev/ai-sdk package to give Vercel AI SDK agents Google Search with the AI Overview, and ChatGPT, Gemini, Google AI Mode and Bing AI Mode answers with sources.

The [`@cloro-dev/ai-sdk`](https://www.npmjs.com/package/@cloro-dev/ai-sdk) npm package wraps cloro's [sync monitor endpoints](https://cloro.dev/docs/guides/making-requests/sync.md) as [Vercel AI SDK](https://ai-sdk.dev) tools. Each tool is a factory that returns an AI SDK `tool()` with a Zod input schema and a typed output. The source lives in the [cloro-ai-sdk repository](https://github.com/cloro-dev/cloro-ai-sdk).

## Prerequisites

* `ai` 6 or 7, and `zod` 3.25.76 or later
* A cloro API key from the [dashboard](https://dashboard.cloro.dev) (see [Authentication](https://cloro.dev/docs/guides/authentication.md))

## Install the package

```bash theme={null}
npm install @cloro-dev/ai-sdk ai zod
```

The tools read `CLORO_API_KEY` from the environment when they run. You can also pass it to each tool: `webSearch({ apiKey: "YOUR_API_KEY" })`.

## Use with an agent

```ts theme={null}
import { generateText, isStepCount } from "ai";
import { webSearch } from "@cloro-dev/ai-sdk";

const { text } = await generateText({
  model: "openai/gpt-5-mini",
  prompt: "What is the boiling point of water at 2,000 meters?",
  tools: {
    webSearch: webSearch(),
  },
  stopWhen: isStepCount(3),
});
```

With `ai` 6, use `stepCountIs` in place of `isStepCount`.

## Available tools

| Tool | Endpoint | The model sends | The tool returns |
| - | - | - | - |
| `webSearch` | [`POST /v1/monitor/google`](https://cloro.dev/docs/api-reference/endpoint/monitor-google) | `query` | The AI Overview text and its sources, and the organic results with title, link and snippet |
| `aiAnswer` | [`POST /v1/monitor/chatgpt`](https://cloro.dev/docs/api-reference/endpoint/monitor-chatgpt), [`gemini`](https://cloro.dev/docs/api-reference/endpoint/monitor-gemini), [`aimode`](https://cloro.dev/docs/api-reference/endpoint/monitor-aimode) or [`bing/aimode`](https://cloro.dev/docs/api-reference/endpoint/monitor-bing-aimode) | `prompt` | The engine's answer and the sources it cites |

Both tools accept `apiKey` and `country` (ISO 3166-1 alpha-2, defaults to `"US"`). `webSearch` also takes `maxResults` (1 to 10) and `includeAiOverview` (defaults to `true`; `false` saves 2 credits). `aiAnswer` takes `engine`: `"chatgpt"` (default), `"gemini"`, `"google-ai-mode"` or `"bing-ai-mode"`. To give the model more than one engine, make one tool for each engine.

Every call is a sync request, so it costs the [provider rate](https://cloro.dev/docs/guides/providers.md) plus the sync surcharge: 7 credits for `webSearch` with the AI Overview.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.