Create custom UIs using the Vercel AI SDK
Copy page
Use the Vercel AI SDK's useChat hook to build React chat interfaces that stream responses from your agent.
Overview
Agents built with Inkeep have an /api/chat
API endpoint that is compatible with Vercel AI SDK's streaming protocol, so it works out of the box with Vercel's AI SDK ecosystem.
To build totally custom UIs, you have two options in the AI SDK ecosystem:
- Use
useChat
hook to build custom UIs in React, Svelte, Vue.js, and Angular. (← this guide) - Use the AI Elements library for a shadcn-like chat primitives.
Using useChat
Install the Vercel AI SDK in your React application:
Basic Configuration
Here's a minimal example of using useChat
with your agent:
Configuration Options
API Endpoint
The api
parameter should point to your Run API's chat endpoint:
- Local development:
http://localhost:3003/api/chat
- Production:
https://your-run-api-domain.com/api/chat
Authentication
Choose the authentication method:
See Authentication → Run API for more details.
Optional Configuration
Headers
To pass required headers (validated against your Context Config), include them as custom headers:
See Headers for details.
Complete Example
Here's a more complete example with conversation management and custom styling:
Environment Variables
For production deployments, store configuration in environment variables:
In local development, the Run API runs at http://localhost:3003
. For production, update this to your deployed Run API URL.