Skip to main content
DeepInfra supports streaming responses via server-sent events (SSE), the same protocol as OpenAI. Set stream: true in your request to enable it.

Examples

SSE format

Each streamed chunk is a data: line containing a JSON object:
The final chunk before [DONE] contains usage information.

Notes

  • Streaming works for all supported models
  • Usage stats are available in the last chunk (when finish_reason is set)
  • The completion_tokens and prompt_tokens counts are the same as non-streaming