The Open Standard for Generative UI
OpenUI Vue Chat
A chat application built with Nuxt 3, Vercel AI SDK, and @openuidev/vue-lang — demonstrating how to render structured LLM output as live Vue components.
How it works
- User sends a message via the chat input
- Server streams a response using the Vercel AI SDK with OpenAI, guided by a system prompt written in openui-lang syntax
@openuidev/vue-langRenderer parses the streaming openui-lang text and renders it as Vue components in real time- Tool calls (weather, stocks, math, web search) are displayed inline with status indicators
Setup
Prerequisites
- Node.js 18+
- pnpm, npm, or Bun
- An OpenUI Cloud API key (https://console.thesys.dev/keys)
Install dependencies
From this example directory:
pnpm install --ignore-workspace
Configure environment
cp .env.example .env
Edit .env and add your OpenUI Cloud API key:
THESYS_API_KEY=sk-th-...
Run
pnpm dev
Open http://localhost:3000.
Project structure
app.vue # Root component (renders NuxtPage)
nuxt.config.ts # Nuxt config (ssr: false, Tailwind CSS, Nitro bundling)
pages/
└── index.vue # Chat UI with AI SDK Chat class + OpenUI Renderer
components/
├── ChatHeader.vue # Top bar with title
├── ChatInput.vue # Message input + send/stop buttons
├── UserMessage.vue # Renders user message parts
├── AssistantMessage.vue # Renders assistant message with OpenUI Renderer
├── LoadingIndicator.vue # Animated loading dots
├── WelcomeScreen.vue # Start page with example prompts
└── openui/ # Vue component renderers for openui-lang output
├── Stack.vue
├── Card.vue
├── TextContent.vue
├── Button.vue
└── Chart.vue
lib/
├── define-library.ts # Shared schemas (server cannot import .vue files)
├── library.ts # Vue renderers wired onto those schemas
└── tools.ts # AI tool definitions (weather, stocks, math, search)
server/
└── api/chat.post.ts # AI SDK streaming endpoint
assets/
└── app.css # Tailwind CSS entry point
Adding components
- Create a Vue component in
components/openui/ - Register it in
lib/define-library.tsand wire the Vue file inlib/library.ts - Restart the dev server so the chat route picks up the new spec
See the @openuidev/vue-lang README for the full API.
Verify
pnpm verify