Streaming
The /v1/bible/ask endpoint streams its response as Server-Sent Events (SSE).
Format
Each event is a data: line followed by two newlines. The server sends tokens one at a time, then citations, then a [DONE] signal:
data: {"token": "The"}
data: {"token": " Bible"}
data: {"token": " teaches"}
data: {"citations": [{"reference": "Ephesians 4:32", "text": "Be kind to one another..."}]}
data: [DONE]
Reading the stream
Event types
| Field | Description |
|---|---|
token | A single word or word-piece of the answer |
citations | Array of {reference, text} objects โ sent once before [DONE] |
Connection management
Keep the HTTP connection open until you receive data: [DONE]. If the connection drops before [DONE], the answer is incomplete โ retry the full request.
Credits are deducted once the stream starts (10 credits per /v1/bible/ask call).