Prerequisites: React 18+ and Tailwind CSS v4.
Built-in AI chat works out of the box through
Optional for a custom/self-hosted AI endpoint: Vercel AI SDK (
Optional for agent actions: modifywithai.
Built-in AI chat works out of the box through
https://better-cmdk.com/api/chat as a free developer trial (no signup, 10 requests per 10 minutes).Optional for a custom/self-hosted AI endpoint: Vercel AI SDK (
ai, @ai-sdk/react).Optional for agent actions: modifywithai.
Define one actions array
Start with one
actions array. CommandMenu will use hosted AI chat by default.Optional: use your own AI endpoint
By default, better-cmdk uses the hosted trial endpoint above. Use this step to run your own route for production.Install AI SDK packages:Add a streaming chat endpoint (Next.js example):Point
CommandMenu to your route:Action behavior
| Action kind | Condition | Selection behavior |
|---|---|---|
| Command-like | No inputSchema | Executes directly from command mode |
| Argument-requiring | Has inputSchema | Routed through chat so the AI can provide arguments |
Next steps
Extending
Design high-quality actions, approvals, custom rendering, and theming.
ModifyWithAI docs
Set up action execution, context, and escalation with the agent platform.