.continue/skills/openui-forge-openai/SKILL.md
OpenUI generative UI with OpenAI SDK backend. Streaming chat completions with gpt-4o.
npx skillsauth add OthmanAdi/openui-forge openui-forge-openaiInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Build generative UI apps with OpenUI + OpenAI SDK. One backend, one adapter, streaming out of the box.
OPENAI_API_KEY environment variable setnpm install @openuidev/react-ui @openuidev/react-headless @openuidev/react-lang lucide-react zod openai
app/layout.tsx:import "@openuidev/react-ui/components.css";
import "@openuidev/react-ui/styles/index.css";
npm run dev and testapp/api/chat/route.tsimport { openuiLibrary } from "@openuidev/react-ui";
import OpenAI from "openai";
const client = new OpenAI();
export async function POST(req: Request) {
const { messages } = await req.json();
const systemPrompt = openuiLibrary.prompt({
preamble: "You are a helpful assistant that generates interactive UIs.",
additionalRules: ["Always use Stack as root when combining multiple components."],
});
const response = await client.chat.completions.create({
model: "gpt-4o",
stream: true,
messages: [{ role: "system", content: systemPrompt }, ...messages],
});
return new Response(response.toReadableStream(), {
headers: { "Content-Type": "text/event-stream" },
});
}
app/chat/page.tsx"use client";
import { FullScreen } from "@openuidev/react-ui";
import { openuiLibrary } from "@openuidev/react-ui";
import {
openAIReadableStreamAdapter,
openAIMessageFormat,
} from "@openuidev/react-headless";
export default function ChatPage() {
return (
<FullScreen
componentLibrary={openuiLibrary}
adapter={openAIReadableStreamAdapter}
messageFormat={openAIMessageFormat}
apiUrl="/api/chat"
/>
);
}
import { defineComponent } from "@openuidev/react-lang";
import { z } from "zod";
export const MyCard = defineComponent({
name: "MyCard",
description: "A card displaying a title and body text",
props: z.object({
title: z.string().describe("The card heading"),
body: z.string().describe("The card body content"),
}),
component: ({ props }) => (
<div style={{ border: "1px solid #ddd", borderRadius: 8, padding: 16 }}>
<h3>{props.title}</h3>
<p>{props.body}</p>
</div>
),
});
Add to a custom library with createLibrary([MyCard, ...others]) or use the built-in openuiLibrary.
For runtime generation (used in the route above), call library.prompt(). For a static file:
npx @openuidev/cli generate ./src/lib/library.ts --out src/generated/system-prompt.txt
OPENAI_API_KEY is set in .env.localresponse.toReadableStream() with text/event-stream content typeopenAIReadableStreamAdapter and openAIMessageFormatcomponentLibrary prop passed to FullScreen| Error | Cause | Fix |
|-------|-------|-----|
| 401 from OpenAI | Missing or invalid API key | Set OPENAI_API_KEY in .env.local |
| Stream hangs | Missing toReadableStream() call | Ensure stream: true and return response.toReadableStream() |
| Components render as text | Library not passed to FullScreen | Add componentLibrary={openuiLibrary} prop |
| Blank screen | CSS not imported | Add both CSS imports to root layout |
| Partial render then stop | Model finished mid-output | Check token limits, increase max_tokens if needed |
development
Build generative UI with OpenUI — any LLM provider, any backend language. Scaffold, integrate, validate.
data-ai
使用 OpenUI 构建生成式 UI 应用 — 支持任意 LLM 提供商、任意后端语言。脚手架、集成、验证。
tools
OpenUI generative UI with Vercel AI SDK. streamText, toUIMessageStreamResponse, and tools support.
development
OpenUI generative UI with Rust Axum backend. Async SSE streaming with reqwest and async-stream.