Skip to main content
Certain API endpoints stream responses by default, such as /api/generate. These responses are provided in the newline-delimited JSON format (i.e. the application/x-ndjson content type). For example:

Disabling streaming

Streaming can be disabled by providing {"stream": false} in the request body for any endpoint that support streaming. This will cause responses to be returned in the application/json format instead:

When to use streaming vs non-streaming

Streaming (default):
  • Real-time response generation
  • Lower perceived latency
  • Better for long generations
Non-streaming:
  • Simpler to process
  • Better for short responses, or structured outputs
  • Easier to handle in some applications