Skip to content

Chat API

The Chat API is a lightweight WebSocket bridge that connects external clients to Nova’s Orchestrator. It provides a real-time streaming chat interface with automatic session management and reconnection handling.

PropertyValue
Port8080
FrameworkFastAPI
State storeRedis (db 3)
Sourcechat-api/
  • WebSocket bridge — accept client WebSocket connections and forward messages to the Orchestrator’s streaming endpoint
  • Session management — assign session IDs to track conversation continuity across reconnections
  • Stream relay — receive SSE chunks from the Orchestrator and relay them as WebSocket messages to the client
  • Test UI — serve a built-in browser-based chat interface at the root URL for quick testing

Connect to ws://localhost:8080/ws/chat. If authentication is enabled, pass the API key as a query parameter:

ws://localhost:8080/ws/chat?token=sk-nova-...

Client to server:

{
"type": "user",
"content": "Your message here",
"session_id": "optional-session-id"
}

Server to client:

TypeDescriptionFields
systemConnection establishedsession_id
stream_chunkStreaming response fragmentdelta
stream_endResponse complete
errorError occurredcontent

If authentication is required and the token is invalid, the WebSocket closes with code 4001. The client should prompt for credentials and reconnect.

MethodPathDescription
WebSocket/ws/chatStreaming chat connection
GET/Built-in test chat UI (HTML)
GET/health/liveLiveness probe
GET/health/readyReadiness probe (checks Orchestrator connectivity)
VariableDescriptionDefault
ORCHESTRATOR_URLURL of the Orchestrator servicehttp://orchestrator:8000
SERVICE_PORTPort to listen on8080
CORS_ALLOWED_ORIGINSComma-separated allowed origins*
LOG_LEVELLogging levelINFO

The Chat API includes a built-in browser chat interface at http://localhost:8080/. It features:

  • Real-time streaming with a typing cursor animation
  • Markdown rendering (code blocks, tables, lists, headings)
  • Session persistence across page reloads
  • API key input for authenticated instances
  • Auto-reconnect on connection loss
  • Nova’s stone/teal design theme

This test UI is useful for verifying that the full pipeline works end-to-end without needing the dashboard.

  • Minimal service — the Chat API is intentionally thin; all business logic lives in the Orchestrator
  • Readiness check — the /health/ready endpoint pings the Orchestrator to verify upstream connectivity
  • CORS — configured with allow_credentials=True to support cross-origin WebSocket connections
  • No database — the Chat API has no direct database dependency; all state flows through the Orchestrator and Redis