Skip to main content
Gemini 3.1 Flash Lite Image (Stream) generates images using Google’s Gemini 3.1 Flash Lite Image model through the native Gemini API via AnyFast. Responses are delivered in real-time using Server-Sent Events (SSE), with thinking chunks arriving first followed by the image data chunk.
Streaming requires a Direct group token. Select the Direct group when creating your token in the AnyFast console.

Key capabilities

  • SSE Streaming — Real-time delivery of thinking and image chunks
  • Thinking mode — Internal reasoning chunks (thought: true) stream before the final image
  • Text-to-image — Generate images from text descriptions
  • Image editing — Pass a reference image in inline_data alongside your text instruction
  • Aspect ratio control1:1, 3:2, 2:3, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9
  • Resolution control — Supports 1K (1024px). 2K and 4K are not supported.

SSE response format

The streaming endpoint returns newline-delimited SSE lines. Each line starts with data: followed by a JSON object. There are three chunk types:
  1. Thinking chunks — Arrive first; parts[0].thought is true
  2. Image chunk — Contains parts[0].inlineData with mimeType and base64 data (note: camelCase in stream response)
  3. Final usage chunk — Contains top-level usageMetadata with thoughtsTokenCount and token details
In the streaming response, the image field is named inlineData (camelCase). In the non-streaming request body, the field is inline_data (snake_case). This is a native Gemini API behaviour.

Text-to-image example

Image editing example (with reference image)

Include 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 Lite Image (Stream).