Build

AI kit

Chat, agent and document Q&A templates, model choice and credit metering.

01Templates

TemplateWhat it doesCredits
ChatModel picker, attachments, web search, reasoning, history and share links1 (web search +2)
DocumentsUpload files, ask questions, answers cite the passage5 per upload, 1 per question
AgentPlans and calls tools in a loop, including MCP servers3

02The guard every request passes

Signed in → workspace member → rate limit → credits → model → refund on failure. Any new AI endpoint does the same:

app/api/your-ai-route/route.ts
const ctx = await requireAiWorkspace(workspace);
const refund = await chargeAi(ctx, "chat");
try {
  // call the model
} catch (error) {
  await refund();
  throw error;
}

Prices and rate limits live in features/ai/config.ts.

03Models

Models run through Vercel AI Gateway with one AI_GATEWAY_API_KEY: Claude, GPT, Gemini, DeepSeek and more are listed in features/ai/config.ts, and adding one is a single entry. Set AI_MOCK=true to use deterministic fakes. To add image generation, speech or another AI feature, follow the add-ai-feature skill.