@runcrate/ai, and the Vercel AI SDK’s useChat hook. Under 50 lines of code for a working chat interface.
Prerequisites
.env.local:
API route
Chat component
npm run dev and open http://localhost:3000.
Add a system prompt selector
Tips
- DeepSeek-V3 is the recommended default — fast, cheap, strong across general tasks.
useChatmanages conversation history client-side. Each POST sends the full message array.- Error handling:
useChatexposes anerrorproperty you can render in the UI.
Next steps
- Vercel AI SDK provider docs
- AI Summarization — add summarization to your chat
- Model catalog — browse all available models