useChat protocol or an OpenAI-shaped protocol, the chat facade in @opengeni/sdk/chat gives it an OpenGeni backend without replacing the UI. It also powers server-side bots through og.chat(...).send().
Serve your chat routes
handleChat for:
Each tenant maps to one workspace and each conversation to one session. Keep one stable conversation id per thread, sent by custom clients in
x-opengeni-conversation, and check that the user may open it. Onboard users first; chat requests never grant membership. With a user, chats default to "private" (personal knowledge on; memory: false turns saving off). Without a user, leaving chats out keeps workspace visibility, session-only reach, and knowledge off; use "shared" for service-owned chats. agent takes the same object as sessions (Configure the agent), and the facade’s renderer defaults to "markdown".
The Vercel and OpenAI formats send only the latest user message. Earlier messages from your app are imported only when the session is first created; after that, OpenGeni owns the history, and messages your app shows but never sends are not added. These routes are served by your backend: the OpenGeni API does not expose /chat/completions or /responses.
Always pass baseUrl; without it the facade targets app.opengeni.ai.
Stream into an existing AI SDK route
To keep an existinguseChat route with its own request body, write OpenGeni’s reply into your own UI message stream with uiMessageStreamParts:
toolParts: true to include OpenGeni’s own tool activity as dynamic tool parts.
Server-side bots
chat.stream(message) yields text, tool activity, pending decisions, and the final reply. chat.snapshot() restores history, and chat.respond(input) continues after a pending approval or question.
Move to the full conversation later
og.client is the full SDK client, and each chat exposes its workspaceId and sessionId. Render the same session with SessionConversation when you are ready. The chat quickstart is a runnable backend.