Quickstart

Scaffold a working streaming chat agent (conversation history, tools, artifacts, and generative UI) in a few minutes with the OpenUI CLI.

The CLI scaffolds a complete Next.js app: a streaming chat with a sidebar, thread list, composer, and generative UI on by default. You write no boilerplate: create, connect, run. You can add an AGENTS.md from here to enable working with coding agents.

1. Create

Run the create command and answer the prompts. One prompt asks OpenUI Cloud or self-hosted? Your choice decides which backend the scaffold wires up.

npx @openuidev/cli@latest create
pnpm dlx @openuidev/cli@latest create
yarn dlx @openuidev/cli@latest create
bunx @openuidev/cli@latest create

When it finishes, move into the project:

cd my-agent

2. Connect

The CLI will prompt you to sign in to Thesys and generate an API Key in your browser, or you can generate your own on the Thesys console and add it to .env.local:

THESYS_API_KEY=sk-th-your-key-here

The scaffold's /api/chat route proxies to Cloud with this key, so it stays on the server. Cloud manages conversation history, artifacts, and built-in tools, so there's no database or renderers to run. See OpenUI Cloud.

The scaffold generates an /api/chat route that calls OpenAI on the server. Add your key to .env.local:

OPENAI_API_KEY=sk-your-key-here

The key stays on the server. The browser only ever talks to your route, never the provider.

3. Run

Start the dev server:

bash npm run dev
bash pnpm dev
bash yarn dev
bash bun dev

Open http://localhost:3000 and send a message. The response streams in token by token, and the assistant can render rich, interactive components inline.

What you get

A working agent out of the box:

  • Streaming chat: responses render token by token in a full layout (sidebar, thread list, composer).
  • Conversation history that persists: past threads are saved and reloadable, not reset on refresh. See Conversations.
  • Tool calling: the agent can call tools mid-response, including built-in Cloud tools like image_search (no code to enable). See Tools.
  • An example artifact: the scaffold ships a slides/report artifact you can prompt for and open in the workspace. See Artifacts.
  • Generative UI, on by default: the assistant renders interactive components inside messages. See Generative UI.

The difference is only in the backing: OpenUI Cloud manages history, artifacts, and built-in tools for you, while self-hosted uses your own OpenAI route and a local store the scaffold generates.

On this page