Skip to content

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 dyui

Live demo deterministic chatbot

How 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.

  1. 01

    You write Python

    One handler streams the model. app.catalog tells DyUI which components to describe in the system prompt.

    Your handler
    @app.on_message
    async def reply(msg, chat):
    async for part in dyui.llm.stream(
    "nvidia/moonshotai/kimi-k2.6",
    chat.history,
    components=app.catalog,
    ):
    yield part
  2. 02

    The model writes components

    Inside its reply, the model writes one JSON object per line in a dyui fence.

    What the model writes
    Revenue is up this month.
    ```dyui
    {"ui":"stat","label":"Revenue","value":"$48.2k","delta":"+12%","trend":"up"}
    ```
  3. 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.

See every component
  • stat
    Monthly recurring revenue
    $48.2k
    +12.4%vs. October
  • badges
    Direct flightFree cancellation2 seats leftEconomyWi‑Fi
  • progress
    Onboarding0%
  • timeline
    1. Order placedMon 09:12

      Payment confirmed — Visa ending 4242.

      done
    2. Packed at warehouseMon 16:40
      done
    3. Out for deliveryToday

      Courier is 4 stops away.

      active
    4. Delivered
      pending
  • rating
    Did this answer your question?
  • callout

    Your refund of €189.00 was approved and will arrive in 3–5 business days.

  • plan
    Planning your trip
    3 of 5
    1. Find flightsdone
    2. Shortlist hotelsdone
    3. Build day-by-day itineraryactive
    4. Estimate budgetpending
    5. Car rentalskipped
  • buttons
  • quick_replies

Quickstart

From one file to a chat app

  1. Install

    Terminal window
    pip install "dyui[openai]"

    The openai extra adds the SDK; anthropic, langgraph and all work the same way.

  2. Write app.py

    app.py
    import dyui
    app = dyui.App(title="Travel Bot", starters=["Plan a weekend in Lisbon"])
    @app.on_message
    async 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 part

    This is the whole app: a title, a starter prompt and one handler. Save it in a new, empty file.

  3. Run it

    Terminal window
    dyui run app.py

    First put your key in a .env file next to app.py: NVIDIA_API_KEY=nvapi-... (free at build.nvidia.com). dyui run loads it. Then open http://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.

Terminal window
pip install dyui
dyui demo

DyUI Docs assistant

Answers come from the DyUI docs. gpt-oss-120b via Groq. Press Escape or the close button to return to the page.