Crucible supports streaming responses via server-sent events (SSE). Streaming lets your application start rendering output before the full response is complete, which significantly improves perceived latency in user-facing applications.
Enabling streaming
Pass "stream": true in your request body.
json
{
"model": "crucible-1",
"prompt": "Analyze the following document...",
"stream": true
}
Handling the stream
Each event in the stream contains a partial output chunk. The stream closes with a final [DONE] event.
js
const stream = await client.completions.create({
model: 'crucible-1',
prompt: 'Analyze the following document...',
stream: true,
});
for await (const chunk of stream) {
process.stdout.write(chunk.output);
}
Pass "stream": true in your request body.
json
{
"model": "crucible-1",
"prompt": "Analyze the following document...",
"stream": true
}
Handling the stream
Each event in the stream contains a partial output chunk. The stream closes with a final [DONE] event.
js
const stream = await client.completions.create({
model: 'crucible-1',
prompt: 'Analyze the following document...',
stream: true,
});
for await (const chunk of stream) {
process.stdout.write(chunk.output);
}
Pass "stream": true in your request body.
json
{
"model": "crucible-1",
"prompt": "Analyze the following document...",
"stream": true
}
Handling the stream
Each event in the stream contains a partial output chunk. The stream closes with a final [DONE] event.
js
const stream = await client.completions.create({
model: 'crucible-1',
prompt: 'Analyze the following document...',
stream: true,
});
for await (const chunk of stream) {
process.stdout.write(chunk.output);
}
Streaming and reasoning mode
Streaming is supported in standard and fast modes. In deep mode, the reasoning trace is not streamed — only the final output is. The full trace is returned in a separate reasoning_trace event at the end of the stream.