Aside: AI memory on 80K+ devicesHow Aside powers AI memory across 80,000+ devices · 113M documents · 24.8B tokens · 150+ countries

Read moreRead the case study
Moss
usemossStart Free
  1. Integrations
  2. /
  3. Vercel AI SDK

Moss + Vercel AI SDK

In-Browser Semantic Search

Get StartedTalk to an Engineer

About Vercel AI SDK

The @moss-tools/vercel-sdk package exposes Moss operations as standard AI SDK tools. Language models can search indexes, create indexes, and manage documents as part of agentic workflows using generateText() or streamText(). Mutating tools set needsApproval: true for user confirmation.

Why Use Moss with Vercel AI SDK

01

Standard AI SDK tool() definitions

mossSearchTool, mossAddDocsTool, mossCreateIndexTool, and more

02

Prebind tools to a specific index

Simpler schemas, or let the LLM choose dynamically

03

Mutating tools set needsApproval: true

Safety for addDocs, createIndex, deleteDocs

04

Works with any AI SDK provider

OpenAI, Anthropic, Google, and more

05

TypeScript-native with typed input/output schemas

via Zod

Quick Start

Explore docs
TypeScript
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import { MossClient } from "@moss-js/moss";
import {
  mossSearchTool,
  mossAddDocsTool,
  mossDeleteDocsTool,
  mossCreateIndexTool,
  mossListIndexesTool,
} from "@moss-tools/vercel-sdk";
import { generateText, stepCountIs } from "ai";
import { openai } from "@ai-sdk/openai";

const client = new MossClient(
  process.env.MOSS_PROJECT_ID!,
  process.env.MOSS_PROJECT_KEY!,
);

// Prebind tools to a specific index for simpler schemas
const tools = {
  search: mossSearchTool({ client, indexName: "docs" }),
  addDocs: mossAddDocsTool({ client, indexName: "docs" }),
  deleteDocs: mossDeleteDocsTool({ client, indexName: "docs" }),
  createIndex: mossCreateIndexTool({ client }),
  listIndexes: mossListIndexesTool({ client }),
};

const result = await generateText({
  model: openai("gpt-4o"),
  tools,
  stopWhen: stepCountIs(5),
  prompt: "Search the docs index for return policy info and summarize it.",
});

Get Started in 3 Steps

01

Install the packages

Run npm install @moss-tools/vercel-sdk @moss-js/moss ai zod to add Moss tools to your project.

02

Initialize tools

Create a MossClient and pass it to the tool factories. Optionally prebind an indexName for simpler LLM schemas.

03

Use with generateText or streamText

Pass the tools object to generateText() or streamText(). The LLM can now search your knowledge base, create indexes, and manage documents autonomously.

Frequently asked questions

Ready to ship faster AI products?

Moss gives you production-ready semantic retrieval without infrastructure complexity.

Test performanceTalk to an Engineer
Moss
AICPA SOC 2 Type 2HIPAA

Product

Founding AgentLocal Search

Use Cases

Voice AIAI CopilotsIn-App SearchOn-Device AI

Company

PricingBlogCareersBrand Kit

Resources

DocsGlossaryBenchmarks

Integrations

DSPyElevenLabsLangChainLiveKitMCP ServerNext.jsPipecatVAPIVercel AI SDKVitePress

© 2026 MOSS

Privacy PolicyTerms of ServiceTrust Center