The API Contract
JSON contract for threads, messages, and streaming.
OpenUI Chat can work with any backend stack as long as the API contract is respected.
Thread endpoints
When using threadApiUrl="/api/threads", OpenUI expects:
| Action | Method | URL |
|---|---|---|
| List threads | GET | /api/threads |
| Create thread | POST | /api/threads |
| Update thread | PUT | /api/threads/:id |
| Delete thread | DELETE | /api/threads/:id |
| Load messages | GET | /api/threads/:id/messages |
Thread shape
type Thread = {
id: string;
title: string;
createdAt: string | number;
};Message formats
Your backend message shape can vary. Use messageFormat to map to/from OpenUI internal shape:
- default OpenUI format
- OpenAI Chat Completions format
- OpenAI Responses conversation-item format
Streaming formats
Use streamProtocol when your backend stream shape is not OpenUI default.
See: