Skip to main content

Overview

The stream_mode parameter gives you control over how streaming responses are formatted. Choose between two modes:
  • full (default) - Traditional streaming format with complete message objects in each chunk
  • concise - Optimized streaming format with reduced redundancy and enhanced reasoning visibility
The concise mode is designed to minimize bandwidth usage and provide better visibility into the model’s reasoning process.

Quick Comparison

Using Concise Mode

Set stream_mode: "concise" when creating streaming completions:

Understanding Chunk Types

In concise mode, you’ll receive four different types of chunks during the stream:

1. chat.reasoning

Streamed during the reasoning stage, containing real-time reasoning steps and search operations.

2. chat.reasoning.done

Marks the end of the reasoning stage and includes all search results (web, images, videos) and reasoning steps.

3. chat.completion.chunk

Streamed during the response generation stage, containing the actual content being generated.

4. chat.completion.done

Final chunk indicating the stream is complete, including final search results, usage statistics, and cost information.

Complete Implementation Examples

Full Concise Mode Handler

Best Practices

1

Aggregate content on the client side

In concise mode, choices.message is not incrementally updated. You must aggregate chunks yourself.
2

Use reasoning steps for transparency

Display reasoning steps to users for better transparency and trust.
3

Handle search results from done chunks only

Search results and usage information only appear in chat.reasoning.done and chat.completion.done chunks.
4

Implement proper type checking

Use the object field to route chunks to appropriate handlers.
5

Track cost from the final chunk

Cost information is only available in the chat.completion.done chunk.

Migration from Full Mode

If you’re migrating from full mode to concise mode, here are the key changes:

When to Use Each Mode

Use Full Mode

  • Simple integrations where you want the SDK to handle aggregation
  • Backward compatibility with existing implementations
  • When you don’t need reasoning visibility

Use Concise Mode

  • Production applications optimizing for bandwidth
  • Applications that need reasoning transparency
  • Real-time chat interfaces with reasoning display
  • Cost-sensitive applications

Resources