v2 Chat

AI chat stream

Stream a response from Elfa AI using Server-Sent Events (SSE).

Use this when your client can consume incremental events. Use POST /v2/chat instead when your integration needs a complete JSON response.

Access: PAYG and Enterprise API keys.

Response format: text/event-stream.

Common data: event payloads include:

  • session_info with sessionId and analysisType
  • title with a generated session or analysis title
  • text with incremental Markdown content
  • text_complete when incremental text has finished
  • status with progress updates
  • credits with consumed credits
  • complete with final sessionId, success, and creditsConsumed; with includeSources: true in the request it also carries sources (the links the research read; same shape as POST /v2/chat)
  • invalid_request when a query is rejected by safety checks
  • error for stream failures

A : keep-alive comment may be sent during long gaps. The stream ends with data: [DONE].

Request-body semantics match POST /v2/chat: message is required only for analysisType: "chat"; token and account modes use assetMetadata.

post/v2/chat/stream

Request

  • Base URL: https://api.elfa.ai
  • URL: https://api.elfa.ai/v2/chat/stream
  • Auth: API key in header x-elfa-api-key

Request body

messagestring

The user message. Required when analysisType is "chat"; ignored for all other analysis types.

sessionIdstring

Omit to start a new conversation. Pass the sessionId from a previous response to continue an existing conversation.

analysisType'chat' | 'macro' | 'summary' | 'tokenIntro' | 'tokenAnalysis' | 'accountAnalysis'

The type of analysis to perform. Defaults to "chat".

  • chat — conversational AI. Requires message.
  • macro — macro market overview.
  • summary — quick market summary.
  • tokenIntro — token introduction. Requires assetMetadata.
  • tokenAnalysis — in-depth token analysis. Requires assetMetadata.
  • accountAnalysis — Twitter/X account analysis. Requires assetMetadata.username.
speed'fast' | 'expert' | 'adaptive'

Response quality mode.

includeSourcesboolean

Set true to receive data.sources: the links the research behind the answer read. Omitted or false leaves the response unchanged.

Response

SSE stream established (text/event-stream)

Changes

No recorded changes to this operation across all 1 revision of this API.