Streaming
Process chat completion tokens in real time using Server-Sent Events.
When stream: true is set, the Bitdeer AI API returns tokens incrementally as Server-Sent Events (SSE). The stream ends with a data: [DONE] message.
Supported models
All text generation models support streaming.
Python
JavaScript / TypeScript
Stream options
Set stream_options.include_usage: true to receive token usage statistics in the final chunk:
The last chunk before [DONE] will contain the full usage object with prompt_tokens, completion_tokens, and total_tokens.
cURL
Each line in the response is prefixed with data: followed by a JSON chunk, and the stream terminates with data: [DONE].
Last updated on