Shared OpenAI-format SSE stream parser.
Used by all OpenAI-compatible providers (OpenAI, DeepSeek, Mistral,
OpenRouter, xAI, Ollama). Each provider calls stream/5 with its
own URL and headers; this module handles SSE parsing and response
normalization.
OpenAI Streaming Format
data: {"choices":[{"index":0,"delta":{"content":"chunk"}}]}
data: {"choices":[{"index":0,"delta":{"tool_calls":[...]}}]}
data: [DONE]Text deltas are emitted via on_chunk. Tool call argument deltas
are accumulated silently. The final response has the same shape as
complete/3.
Summary
Functions
Execute a streaming request against an OpenAI-compatible endpoint.