Skip to main content
Vercel AI SDK tools and Vercel Connect Give any AI SDK call web search and page fetch, and keep your Keenable API key out of environment variables. Use these two pieces together or on their own:
  • @keenable/ai-sdk gives any generateText or streamText call web search and page fetch as AI SDK tools. It works without a key, so the first snippet below runs as-is.
  • Vercel Connect lists Keenable in its catalog. Connect keeps your API key at the team level and hands it to your code at runtime with getToken, so the key never sits in an environment variable.
→ @keenable/ai-sdk on npm · Keenable on Vercel Connect

Vercel AI SDK tools

Install

ai and zod are peer dependencies, already present in an AI SDK project. The package works with ai v5, v6 and v7, and with zod v3 and v4. The examples use @ai-sdk/openai, but any model provider works.

Add the tools

Pass keenableTools() to generateText:
stopWhen lets the model search, read the results and then answer. Without it, generateText stops after the first step and returns only the tool call. The model sees the tools as keenable_search and keenable_fetch. To add only one tool, import keenableSearch or keenableFetch instead of the pair.
Set KEENABLE_API_KEY to remove the hourly request cap. If you don’t set a key, calls run on the shared keyless tier, which allows 1,000 requests per hour per IP address. See Rate limits.
Or pass the key directly: keenableTools({ apiKey: "keen_<your_key>" }). On Vercel, keep the key in Vercel Connect instead of an environment variable.

Keep the key in Vercel Connect

You don’t need Connect, or a key, to start. A key lifts the request limits, and Connect is where a Vercel project keeps it.

Get a key

Create an API key in the Keenable console.

Create the connector

In the Vercel dashboard, open Connect for your project, select Create Connector and choose Keenable. A connector created from the project page is linked to that project. Or, from a directory linked to the project:
The CLI asks for the connection method and the key. Choose API key. An API key works for both the REST API and the MCP server, and it needs no signed-in user, so backends and cron jobs can use it.

Fetch the key at runtime

Fetch the key with getToken and pass it to keenableTools:
keenable/keenable is the connector’s UID: the service, then the name you gave it. On Vercel, getToken authenticates with the deployment’s OIDC token. Locally, run vercel env pull first. Call getToken per request rather than once at startup. The SDK caches the key in process. Without the AI SDK package, send the same value to the REST API as X-API-Key or Authorization: Bearer:

OAuth for MCP

The connector also offers OAuth for the MCP server. With Connect’s OAuth method, each user signs in to Keenable once and Connect stores their token. Their calls then run on their own Keenable account with no key to copy, as in the ChatGPT install. The OAuth method issues user tokens only (subject: { type: "user", id }), so use the API key method for anything that runs without a signed-in user.

Billing

Connect stores the credential and nothing else. Keenable bills the calls to the organization that owns the key, at 100,000 free requests a month, then $4 per 1,000. See Pricing. Vercel doesn’t charge for them.

Mastra

Give Mastra agents web search and page fetch with the @keenable/mastra package: the keenable-search and keenable-fetch tools.

OpenRouter

Web search and page fetch for any OpenRouter model, as tools it calls itself: from Python, the AI SDK, or the Agent SDK over MCP. No Keenable key needed.

Agno

Give Agno agents web search and page reading with KeenableTools, a toolkit built into Agno, with no API key required.

npcpy

Search the web from npcpy with the keenable provider for search_web, or call search_keenable directly. No API key needed, in npcpy 2.1.28 and later.