Skip to main content
Gemini 3.1 Flash Image Preview (Streaming) is available through Starrise AI via the native Gemini API, supporting real-time SSE streaming of image generation results. Thinking chunks are pushed first, followed immediately by the final image chunk.

Key Capabilities

  • SSE streaming — Real-time delivery of thinking chunks and image chunks
  • Thinking mode — Internal reasoning chunks (thought: true) streamed before the image
  • Text-to-image — Generate images from text descriptions
  • Image editing — Pass a reference image via inline_data combined with text instructions
  • Aspect ratio control1:1, 4:3, 3:4, 16:9, 9:16
  • Resolution control1K (~1024px), 2K (~2048px), 4K (~4096px, by longest side)

SSE Response Format

The streaming endpoint returns newline-delimited SSE data lines, each starting with data: followed by a JSON object. There are three chunk types:
  1. Thinking chunk — Arrives first; parts[0].thought is true
  2. Image chunk — Contains parts[0].inlineData with mimeType and base64 data (note: camelCase in streaming responses)
  3. Final usage chunk — Contains top-level usageMetadata with thoughtsTokenCount and per-modality token details
In streaming responses, the image field is inlineData (camelCase), while in the request body it is inline_data (snake_case). This is native Gemini API behavior.

Text-to-Image Example

Image Editing Example (with Reference Image)

Pass both a text instruction and an inline_data reference image in the same parts array.

Parameters

API Reference

View the interactive API Playground for Gemini 3.1 Flash Image Preview (Streaming).