thesys|
OpenUI

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:

ActionMethodURL
List threadsGET/api/threads
Create threadPOST/api/threads
Update threadPUT/api/threads/:id
Delete threadDELETE/api/threads/:id
Load messagesGET/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:

On this page