Google Flow
Image & Video API

OpenAI-compatible API for Google's Imagen 4, Nano Banana 2, Nano Banana Pro image generation and Veo 2/3.1 video generation. Supports text-to-image, image-to-image, text-to-video, image-to-video, and reference-based video generation.

Nano Banana 2 (NARWHAL) Nano Banana Pro (GEM_PIX_2) Imagen 4 (IMAGEN_3_5) Veo 2.0 / 2.1 / 3.1
🔑
Authentication
All API requests require an API key. Pass it as Authorization: Bearer YOUR_API_KEY header, or x-goog-api-key: YOUR_API_KEY header, or ?key=YOUR_API_KEY query parameter.
Manage API keys and tokens in the Admin Panel.
Endpoints
GET /v1/models List available models

Returns all available image and video generation models with their IDs and descriptions.

Request
curl BASE_URL/v1/models \
  -H "Authorization: Bearer YOUR_API_KEY"
Response
{
  "object": "list",
  "data": [
    {
      "id": "gemini-3.1-flash-image-landscape",
      "object": "model",
      "owned_by": "flow2api",
      "description": "Image generation - NARWHAL"
    },
    ...
  ]
}
GET /v1/models/aliases Simplified model aliases

List simplified model aliases for generationConfig-based resolution. Useful when using Gemini-native endpoints.

Request
curl BASE_URL/v1/models/aliases \
  -H "Authorization: Bearer YOUR_API_KEY"
POST /v1/chat/completions OpenAI-compatible generation

The primary endpoint. OpenAI-compatible unified generation for images and videos. Select a model to control what gets generated. Supports streaming responses.

ParameterTypeDescription
model required string Model ID (e.g. gemini-3.1-flash-image-landscape)
messages required array Array of { role, content } messages. Content can be a string (text prompt) or array of content parts for multimodal input.
stream optional boolean Enable streaming response. Default: false
image optional string Base64-encoded image for image-to-image generation
video optional string Base64-encoded video for video reference
Text-to-Image
curl -X POST BASE_URL/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-3.1-flash-image-landscape",
    "messages": [
      {
        "role": "user",
        "content": "A red apple on a wooden table, studio lighting, minimal background"
      }
    ],
    "stream": true
  }'
Image-to-Image (edit an existing image)
curl -X POST BASE_URL/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-3.1-flash-image-landscape",
    "messages": [
      {
        "role": "user",
        "content": [
          {
            "type": "text",
            "text": "Turn this into a watercolor painting style"
          },
          {
            "type": "image_url",
            "image_url": {
              "url": "data:image/jpeg;base64,<BASE64_IMAGE>"
            }
          }
        ]
      }
    ],
    "stream": true
  }'
Text-to-Video
curl -X POST BASE_URL/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "veo_3_1_t2v_fast_landscape",
    "messages": [
      {
        "role": "user",
        "content": "A kitten chasing butterflies across a sunlit meadow"
      }
    ],
    "stream": true
  }'
Image-to-Video (first/last frame)
curl -X POST BASE_URL/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "veo_3_1_i2v_s_fast_fl",
    "messages": [
      {
        "role": "user",
        "content": [
          {
            "type": "text",
            "text": "Transition from the first frame to the second"
          },
          {
            "type": "image_url",
            "image_url": {
              "url": "data:image/jpeg;base64,<FIRST_FRAME_BASE64>"
            }
          },
          {
            "type": "image_url",
            "image_url": {
              "url": "data:image/jpeg;base64,<LAST_FRAME_BASE64>"
            }
          }
        ]
      }
    ],
    "stream": true
  }'
Multi-Reference Video (R2V)
curl -X POST BASE_URL/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "veo_3_1_r2v_fast",
    "messages": [
      {
        "role": "user",
        "content": [
          {
            "type": "text",
            "text": "Create a video featuring these reference elements"
          },
          {
            "type": "image_url",
            "image_url": { "url": "data:image/jpeg;base64,<REF1>" }
          },
          {
            "type": "image_url",
            "image_url": { "url": "data:image/jpeg;base64,<REF2>" }
          }
        ]
      }
    ],
    "stream": true
  }'
Response (streaming SSE)
data: {"id":"chatcmpl-...","object":"chat.completion.chunk","model":"gemini-3.1-flash-image-landscape","choices":[{"index":0,"delta":{"role":"assistant","content":"![image](data:image/png;base64,iVBORw0KGgo...)"},"finish_reason":"stop"}]}

data: [DONE]
POST /models/{model}:generateContent Gemini-native generation

Gemini-native endpoint. Supports systemInstruction, contents[].parts[].text, inlineData, fileData, and generationConfig with responseModalities and imageConfig. Also available at /v1beta/models/{model}:generateContent.

ParameterTypeDescription
contents required array Array of content objects with role and parts
systemInstruction optional object System instruction with parts[].text
generationConfig optional object responseModalities (e.g. ["IMAGE"]), imageConfig.aspectRatio (e.g. "1:1"), imageConfig.imageSize (e.g. "1K", "2K", "4K")
Gemini-native Image Generation
curl -X POST BASE_URL/models/gemini-3.1-flash-image:generateContent \
  -H "x-goog-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "systemInstruction": {
      "parts": [{ "text": "Return an image only." }]
    },
    "contents": [
      {
        "role": "user",
        "parts": [
          { "text": "A red apple on a wooden table, studio lighting" }
        ]
      }
    ],
    "generationConfig": {
      "responseModalities": ["IMAGE"],
      "imageConfig": {
        "aspectRatio": "1:1",
        "imageSize": "1K"
      }
    }
  }'
Response
{
  "candidates": [
    {
      "content": {
        "parts": [
          {
            "inlineData": {
              "mimeType": "image/png",
              "data": "iVBORw0KGgo..."
            }
          }
        ],
        "role": "model"
      }
    }
  ]
}
POST /models/{model}:streamGenerateContent Gemini streaming generation

Same as generateContent but returns a streaming response. Also available at /v1beta/models/{model}:streamGenerateContent. Append ?alt=sse for SSE format.

Request
curl -X POST "BASE_URL/models/gemini-3.0-pro-image:streamGenerateContent?alt=sse" \
  -H "x-goog-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "contents": [
      {
        "role": "user",
        "parts": [{ "text": "Generate an artistic portrait" }]
      }
    ],
    "generationConfig": {
      "responseModalities": ["IMAGE"],
      "imageConfig": { "aspectRatio": "3:4", "imageSize": "2K" }
    }
  }'
POST /api/tokens Add a Google session token

Add a new Google session token (ST — __Secure-next-auth.session-token cookie value from labs.google). The service will automatically obtain an access token (AT) from it. Requires admin authentication.

ParameterTypeDescription
st required string The session token cookie value
remark optional string A label/note for this token
image_enabled optional boolean Enable image generation for this token. Default: true
video_enabled optional boolean Enable video generation for this token. Default: true
Request (Admin auth required — login first at /manage)
curl -X POST BASE_URL/api/tokens \
  -H "Content-Type: application/json" \
  -b "session=ADMIN_SESSION_COOKIE" \
  -d '{
    "st": "YOUR_GOOGLE_SESSION_TOKEN",
    "remark": "Main account"
  }'
GET /api/tokens List all tokens

List all registered Google session tokens and their status. Requires admin authentication.

Request
curl BASE_URL/api/tokens \
  -b "session=ADMIN_SESSION_COOKIE"
GET /api/system/info System information

Returns system information including version, uptime, token count, and configuration. Requires admin authentication.

Request
curl BASE_URL/api/system/info \
  -b "session=ADMIN_SESSION_COOKIE"
Image Generation Models

Nano Banana 2 (NARWHAL) — gemini-3.1-flash-image

Model IDOrientationResolution
gemini-3.1-flash-image-landscapeLandscapeStandard
gemini-3.1-flash-image-portraitPortraitStandard
gemini-3.1-flash-image-squareSquareStandard
gemini-3.1-flash-image-four-three4:3Standard
gemini-3.1-flash-image-three-four3:4Standard
gemini-3.1-flash-image-landscape-2kLandscape2K
gemini-3.1-flash-image-portrait-2kPortrait2K
gemini-3.1-flash-image-square-2kSquare2K
gemini-3.1-flash-image-four-three-2k4:32K
gemini-3.1-flash-image-three-four-2k3:42K
gemini-3.1-flash-image-landscape-4kLandscape4K
gemini-3.1-flash-image-portrait-4kPortrait4K
gemini-3.1-flash-image-square-4kSquare4K
gemini-3.1-flash-image-four-three-4k4:34K
gemini-3.1-flash-image-three-four-4k3:44K

Nano Banana Pro (GEM_PIX_2) — gemini-3.0-pro-image

Model IDOrientationResolution
gemini-3.0-pro-image-landscapeLandscapeStandard
gemini-3.0-pro-image-portraitPortraitStandard
gemini-3.0-pro-image-squareSquareStandard
gemini-3.0-pro-image-four-three4:3Standard
gemini-3.0-pro-image-three-four3:4Standard
gemini-3.0-pro-image-landscape-2kLandscape2K
gemini-3.0-pro-image-portrait-2kPortrait2K
gemini-3.0-pro-image-square-2kSquare2K
gemini-3.0-pro-image-four-three-2k4:32K
gemini-3.0-pro-image-three-four-2k3:42K
gemini-3.0-pro-image-landscape-4kLandscape4K
gemini-3.0-pro-image-portrait-4kPortrait4K
gemini-3.0-pro-image-square-4kSquare4K
gemini-3.0-pro-image-four-three-4k4:34K
gemini-3.0-pro-image-three-four-4k3:44K

Imagen 4 (IMAGEN_3_5) — imagen-4.0-generate-preview

Model IDOrientationResolution
imagen-4.0-generate-preview-landscapeLandscapeStandard
imagen-4.0-generate-preview-portraitPortraitStandard

Gemini Flash (GEM_PIX) — gemini-2.5-flash-image

Model IDOrientationResolution
gemini-2.5-flash-image-landscapeLandscapeStandard
gemini-2.5-flash-image-portraitPortraitStandard
Video Generation Models

Text-to-Video (T2V)

Model IDOrientationQuality
veo_3_1_t2v_fast_landscapeLandscapeFast
veo_3_1_t2v_fast_portraitPortraitFast
veo_3_1_t2v_landscapeLandscapeStandard
veo_3_1_t2v_portraitPortraitStandard
veo_3_1_t2v_fast_ultraLandscapeUltra
veo_3_1_t2v_fast_portrait_ultraPortraitUltra
veo_3_1_t2v_fast_ultra_relaxedLandscapeUltra Relaxed
veo_3_1_t2v_fast_portrait_ultra_relaxedPortraitUltra Relaxed
veo_2_1_fast_d_15_t2v_landscapeLandscapeVeo 2.1
veo_2_1_fast_d_15_t2v_portraitPortraitVeo 2.1
veo_2_0_t2v_landscapeLandscapeVeo 2.0
veo_2_0_t2v_portraitPortraitVeo 2.0

Image-to-Video (I2V) — First/Last Frame

1 image = first frame only. 2 images = first frame + last frame transition.

Model IDOrientationQuality
veo_3_1_i2v_s_fast_flLandscapeFast
veo_3_1_i2v_s_fast_portrait_flPortraitFast
veo_3_1_i2v_s_fast_ultra_flLandscapeUltra
veo_3_1_i2v_s_fast_portrait_ultra_flPortraitUltra
veo_3_1_i2v_s_fast_ultra_relaxedLandscapeUltra Relaxed
veo_3_1_i2v_s_fast_portrait_ultra_relaxedPortraitUltra Relaxed
veo_3_1_i2v_s_landscapeLandscapeStandard
veo_3_1_i2v_s_portraitPortraitStandard
veo_2_1_fast_d_15_i2v_landscapeLandscapeVeo 2.1
veo_2_1_fast_d_15_i2v_portraitPortraitVeo 2.1
veo_2_0_i2v_landscapeLandscapeVeo 2.0
veo_2_0_i2v_portraitPortraitVeo 2.0

Reference-to-Video (R2V) — Multiple Reference Images

Up to 3 reference images. System auto-selects model key based on image count.

Model IDOrientationQuality
veo_3_1_r2v_fastLandscapeFast
veo_3_1_r2v_fast_portraitPortraitFast
veo_3_1_r2v_fast_ultraLandscapeUltra
veo_3_1_r2v_fast_portrait_ultraPortraitUltra
veo_3_1_r2v_fast_ultra_relaxedLandscapeUltra Relaxed
veo_3_1_r2v_fast_portrait_ultra_relaxedPortraitUltra Relaxed

Video Upscale Models

Upscale generated videos to 1080p or 4K resolution.

Model IDSourceOutput
veo_3_1_t2v_fast_4kT2V4K
veo_3_1_t2v_fast_portrait_4kT2V4K
veo_3_1_t2v_fast_ultra_4kT2V Ultra4K
veo_3_1_t2v_fast_portrait_ultra_4kT2V Ultra4K
veo_3_1_t2v_fast_1080pT2V1080p
veo_3_1_t2v_fast_portrait_1080pT2V1080p
veo_3_1_t2v_fast_ultra_1080pT2V Ultra1080p
veo_3_1_t2v_fast_portrait_ultra_1080pT2V Ultra1080p
veo_3_1_i2v_s_fast_ultra_fl_4kI2V Ultra4K
veo_3_1_i2v_s_fast_portrait_ultra_fl_4kI2V Ultra4K
veo_3_1_i2v_s_fast_ultra_fl_1080pI2V Ultra1080p
veo_3_1_i2v_s_fast_portrait_ultra_fl_1080pI2V Ultra1080p
veo_3_1_r2v_fast_ultra_4kR2V Ultra4K
veo_3_1_r2v_fast_portrait_ultra_4kR2V Ultra4K
veo_3_1_r2v_fast_ultra_1080pR2V Ultra1080p
veo_3_1_r2v_fast_portrait_ultra_1080pR2V Ultra1080p

Important Notes