Overview
Streaming allows you to receive partial responses as they’re generated, providing a better user experience for chat applications.Enable Streaming
Setstream: true in your request:
Stream Response Format
Each chunk in the stream follows this format:Handling Stream End
The stream ends with:finish_reason: "stop"- Normal completionfinish_reason: "length"- Hit max_tokens limitfinish_reason: "tool_calls"- Model wants to call a tooldata: [DONE]- Final message