DyUI — Chatbots that answer in interfaces
Open source Python 3.10+ MIT licensed
Chatbots that answer in interfaces.
DyUI is a Python framework for professional chat apps. Write one file, rundyui run, and your model replies with tables, charts, cards, forms and buttons — not just text.
pip install dyuiHow it works
Text in, interface out
The model never writes markup. It writes data in a format DyUI taught it, and DyUI turns that into real components.
01
You write Python
One handler streams the model.
app.catalogtells DyUI which components to describe in the system prompt.Your handler @app.on_messageasync def reply(msg, chat):async for part in dyui.llm.stream("nvidia/moonshotai/kimi-k2.6",chat.history,components=app.catalog,):yield part02
The model writes components
Inside its reply, the model writes one JSON object per line in a
dyuifence.What the model writes Revenue is up this month.```dyui{"ui":"stat","label":"Revenue","value":"$48.2k","delta":"+12%","trend":"up"}```03
DyUI renders them
Each line is parsed as it streams, validated against the same pydantic model, and rendered between sentences.
Revenue is up this month.
Revenue$48.2k+12%
What you get
A finished chat app around your model
- The model renders the interface
- DyUI writes the component section of your system prompt, parses the model's reply while it streams, validates every component and renders it between sentences.
- A finished chat app
- History, stop and regenerate, editing, uploads, feedback, light and dark themes, a mobile layout and an optional password — with calm motion on every interaction.
- Any model, any framework
- NVIDIA NIM, OpenAI, Anthropic, Ollama, Groq, OpenRouter, Gemini, Mistral, DeepSeek, Together, xAI and LangGraph — or your own SDK. Anything that streams text works.
- Components in pure Python
- Describe a component as a pydantic model with a render() method. The model learns it on the next turn; the prompt grows with your app.
- Interfaces that answer back
- Buttons, forms, choices and approvals reach your Python handlers or go straight back to the model. await chat.ask(...) pauses for a human decision.
- The model only sends data
- No HTML from the model, filtered links, verified actions, and developer HTML rendered in a sandboxed iframe.
Component library
36 components the model can use
Each one streams in while the model is still writing it, works in light and dark, and is keyboard accessible.
- statMonthly recurring revenue$48.2k+12.4%vs. October
- badgesDirect flightFree cancellation2 seats leftEconomyWi‑Fi
- progressOnboarding0%
- timeline
- Order placedMon 09:12
Payment confirmed — Visa ending 4242.
done - Packed at warehouseMon 16:40done
- Out for deliveryToday
Courier is 4 stops away.
active - Deliveredpending
- rating
- callout
Your refund of €189.00 was approved and will arrive in 3–5 business days.
- planPlanning your trip3 of 5
- Find flightsdone
- Shortlist hotelsdone
- Build day-by-day itineraryactive
- Estimate budgetpending
- Car rentalskipped
- buttons
- quick_replies
Quickstart
From one file to a chat app
Install
Terminal window pip install "dyui[openai]"The
openaiextra adds the SDK;anthropic,langgraphandallwork the same way.Write
app.pyapp.py import dyuiapp = dyui.App(title="Travel Bot", starters=["Plan a weekend in Lisbon"])@app.on_messageasync def reply(msg: dyui.Message, chat: dyui.Chat):async for part in dyui.llm.stream("nvidia/moonshotai/kimi-k2.6", chat.history,system="You are a calm, expert travel agent.",components=app.catalog):yield partThis is the whole app: a title, a starter prompt and one handler. Save it in a new, empty file.
Run it
Terminal window dyui run app.pyFirst put your key in a
.envfile next toapp.py:NVIDIA_API_KEY=nvapi-...(free at build.nvidia.com).dyui runloads it. Then openhttp://localhost:8000; the app reloads when you save.API keys for every provider.
No API key needed
Try it without an API key
The built-in demo walks through components, actions, steps and approvals with a simulated model.
pip install dyuidyui demo