Skip to main content

For AI agents: docs.octen.ai/integrations/vercel-ai-sdk.md

The @octen.ai/ai-sdk-tools package provides the ready-made Vercel AI SDK tools listed in Tools.

Get API Key

Create a key from the API Platform.

npm

The @octen.ai/ai-sdk-tools package.

Install

Requires Node.js 22+.

Quick Start

Set your Octen and OpenAI API keys:
Run a model that answers with Octen Web Search and News Search:
stopWhen: isStepCount(5) lets the model search, read the results, and answer within five steps. Without it, generateText stops after the search and text is empty. The example uses ai 7. On ai 5 or 6, use stepCountIs in place of isStepCount, and install @ai-sdk/openai@ai-v5 or @ai-sdk/openai@ai-v6 to match.

Tools

Each tool reads OCTEN_API_KEY unless you pass apiKey. For the search tools, set any parameter other than query in defaults, with its API reference name: octenWebSearch({ defaults: { count: 10, result_type: "dynamic" } }). A parameter you set in defaults is no longer offered to the model. Image Search, Design Search, and Extract take named options instead of defaults; see the package README. Skip the tool loop and let Octen run the searches server-side with Auto Search. Point the model at the Octen base URL and enable the built-in octen_search tool. Your Octen API key is the only key you need. Install the provider for OpenAI-compatible APIs:
Run the model:

Last modified on November 24, 2026