API reference · Chat
POST/api/chat/stream/{slug}

Stream AI chat response

Enterprise-only AI chat endpoint that accepts conversation messages and returns an assistant response via Server-Sent Events. Requires a valid Auth.js session and the aiAssistant experimental feature enabled for the tenant. The slug path segment is accepted by the catch-all route but is not used by the implementation. API-key authentication is skipped for /api/chat; tenant context comes from the session.

Path parameters

slugstringRequired
Catch-all chat stream path segment. The current handler accepts the value but does not use it.

Request body

Content type: application/json · schema ChatStreamRequest

inputsarray of ChatMessageRequired
Conversation messages in order. These are passed to the OpenRouter chat model.
min items 1
itemsobject
rolestringRequired
Role of the message author in the conversation.
Enum: userassistant
contentstringRequired
Message text sent to the chat model.
optionsobject
Optional model options. Currently declared by the internal interface but not consumed by the handler.
modelstring
Optional model override. Currently ignored; the server uses OPENROUTER_CHAT_MODEL or minimax/minimax-m2.
metaobject
Optional metadata for legacy chat clients.
authorizationstring
Optional downstream authorization token. Currently declared but not consumed by the handler.

Response codes

200
SSE stream of chat response events. Each data frame contains content and type.
403
AI Assistant feature is not enabled for the tenant.
404
Chat streaming is not available in this edition.
500
Malformed request, missing OpenRouter API key, or another internal streaming failure.