1
Create the server
Expose a
/api/chat API endpoint with Express. Use Vercel AI SDK to create a streamText agent. Return the stream value.2
Connect the widget
Paste the streaming URL endpoint into the
<OpenChatWidget /> UI component:3
Test the full loop
Your chat widget should now be connected to your AI agent. Go back to your widget, you should be now be able to chat with your agent. Make sure to bring your own API keys from your favorite LLM provider.
Building capable agents
Explore real-world agent use cases and the kinds of assistants you can build with Open Chat Widget.