> ## Documentation Index
> Fetch the complete documentation index at: https://docs.anyfast.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# gemini-nano-banana-2.1-stream

> Sends a GenerateContent request and returns a Server-Sent Events stream containing GenerateContentResponse chunks.




## OpenAPI

````yaml api-reference/model-api/google/openapi/gemini-nano-banana-2-1-stream/openapi.yaml POST /v1beta/models/gemini-nano-banana-2.1:streamGenerateContent
openapi: 3.1.0
info:
  title: Gemini Nano Banana 2.1 (Stream)
  description: Stream Gemini Nano Banana 2.1 responses through AnyFast's native Gemini API.
  version: 1.0.0
servers:
  - url: https://www.anyfast.ai
security: []
paths:
  /v1beta/models/gemini-nano-banana-2.1:streamGenerateContent:
    post:
      summary: Generate image content as an SSE stream
      description: >
        Sends a GenerateContent request and returns a Server-Sent Events stream
        containing GenerateContentResponse chunks.
      operationId: GeminiNanoBanana21StreamGenerateContent
      parameters:
        - name: key
          in: query
          required: true
          description: AnyFast API key.
          schema:
            type: string
          example: YOUR_API_KEY
        - name: alt
          in: query
          required: false
          description: Set to sse to explicitly request Server-Sent Events mode.
          schema:
            type: string
            enum:
              - sse
          example: sse
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GenerateContentRequest'
      responses:
        '200':
          description: >
            Server-Sent Events stream. Each data event contains one JSON
            GenerateContentResponse chunk.
          content:
            text/event-stream:
              schema:
                type: string
                description: Newline-delimited SSE events with JSON response chunks.
              example: >
                data:
                {"candidates":[{"content":{"role":"model","parts":[{"text":"..."}]}}]}


                data:
                {"candidates":[{"content":{"role":"model","parts":[{"inlineData":{"mimeType":"image/png","data":"<base64>"}}]}}]}


                data:
                {"usageMetadata":{"promptTokenCount":24,"candidatesTokenCount":1024,"totalTokenCount":1048}}
        '400':
          description: Invalid request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Invalid or missing API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Rate limit exceeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      x-codeSamples:
        - lang: bash
          label: cURL
          source: |
            curl --no-buffer \
              --request POST \
              --url 'https://www.anyfast.ai/v1beta/models/gemini-nano-banana-2.1:streamGenerateContent?key=YOUR_API_KEY' \
              --header 'Content-Type: application/json' \
              --data '{
                "contents": [{
                  "role": "user",
                  "parts": [{"text": "Create a green data center illustration."}]
                }],
                "generationConfig": {
                  "responseModalities": ["TEXT", "IMAGE"],
                  "imageConfig": {"aspectRatio": "16:9", "imageSize": "1K"}
                }
              }'
components:
  schemas:
    GenerateContentRequest:
      type: object
      required:
        - contents
      properties:
        contents:
          type: array
          items:
            $ref: '#/components/schemas/Content'
        generationConfig:
          $ref: '#/components/schemas/GenerationConfig'
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: integer
            message:
              type: string
            status:
              type: string
    Content:
      type: object
      required:
        - parts
      properties:
        role:
          type: string
          enum:
            - user
            - model
          default: user
        parts:
          type: array
          items:
            $ref: '#/components/schemas/RequestPart'
    GenerationConfig:
      type: object
      properties:
        responseModalities:
          type: array
          items:
            type: string
            enum:
              - TEXT
              - IMAGE
          example:
            - TEXT
            - IMAGE
        imageConfig:
          type: object
          properties:
            aspectRatio:
              type: string
              example: '16:9'
            imageSize:
              type: string
              enum:
                - 1K
                - 2K
                - 4K
              default: 1K
        thinkingConfig:
          type: object
          additionalProperties: true
    RequestPart:
      type: object
      properties:
        text:
          type: string
        inlineData:
          $ref: '#/components/schemas/InlineData'
        fileData:
          type: object
          additionalProperties: true
    InlineData:
      type: object
      required:
        - mimeType
        - data
      properties:
        mimeType:
          type: string
          example: image/png
        data:
          type: string
          format: byte
          description: Base64-encoded media bytes.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.