Contact
← Rai Kit projectdocs

rai kit docs

Coming soon: a shadcn-style assistant kit. The plan is to copy the source into your app, configure the assistant in TypeScript, keep secrets in env, and let the agent search a site index plus the current page.

Install

# coming soon
npx rai-kit init

This command is not published yet. Once it is, it will copy the starter into your app. The installed files will be yours to edit, just like shadcn components.

src/components/rai/rai-launcher.tsx
src/components/rai/rai-orb.tsx
src/app/api/rai/route.ts
src/app/api/rai/share/route.ts
src/lib/rai/config.ts
src/lib/rai/content-index.ts
src/lib/rai/guardrails.ts
src/lib/rai/rate-limit.ts

Mount

Add the launcher once in your app shell, layout, or chrome component.

import { RaiLauncher } from "@/components/rai/rai-launcher"

export function SiteChrome({ children }: { children: React.ReactNode }) {
  return (
    <>
      {children}
      <RaiLauncher />
    </>
  )
}

Configure

Public behavior will live in src/lib/rai/config.ts. Runtime secrets stay in env.

export const raiConfig = {
  assistant: {
    name: "rai",
    label: "Ask rai",
    voice: "warm, sharp, concise",
    scope: ["projects", "writing", "about", "contact"],
  },
  site: {
    name: "Your Site",
    url: "https://example.com",
  },
  owner: {
    name: "Your Name",
    publicEmail: "[email protected]",
  },
  model: {
    provider: "openai",
    name: "gpt-5.4-nano",
    maxOutputTokens: 600,
    temperature: 0.4,
  },
}

Environment

OPENAI_API_KEY=

# optional
RAI_ALLOWED_ORIGINS=
UPSTASH_REDIS_REST_URL=
UPSTASH_REDIS_REST_TOKEN=

Site awareness

Rai Kit will use two channels for context. The server gets a generated site index for durable knowledge. The launcher sends the current pathname, browser title, and live page headings on each turn, so it can answer or scroll based on what the visitor is looking at right now.

The base template includes a manual content-index.ts seed. The next step is the indexer command that fills it from Next routes, Markdown, MDX, Notion, or a custom adapter.