Skip to content

Support all Gemini native image models (including 🍌) #320

@tombeckenham

Description

@tombeckenham

Problem

The Gemini image adapter currently only routes gemini-3.1-flash-image-preview (🍌 Nano Banana 2) through the generateContent API path. The other three Gemini native image models should also use this path:

  • gemini-3-pro-image-preview
  • gemini-2.5-flash-image
  • gemini-2.0-flash-preview-image-generation

Additionally, the current implementation has several bugs:

  1. Wrong config property: Uses imageGenerationConfig but the SDK's GenerateContentConfig expects imageConfig
  2. Wrong size property: Uses outputImageSize but the SDK's ImageConfig expects imageSize
  3. Invalid type values: GeminiNanoBananaAspectRatio includes ratios not in the SDK (1:4, 1:8, 4:1, 4:5, 5:4, 8:1) and GeminiNanoBananaResolution includes 512px (SDK only supports 1K, 2K, 4K)

Expected Behavior

  • All gemini-* image models should route through the generateContent API with responseModalities: ['IMAGE']
  • Imagen models (imagen-3.0-*, imagen-4.0-*) should continue using the generateImages API
  • Config properties should match the @google/genai SDK types (GenerateContentConfig, ImageConfig)
  • Type definitions should only include values actually supported by the SDK
  • Types should be renamed from GeminiNanoBanana* to GeminiNativeImage* since they apply to all Gemini native image models, not just 🍌

References

  • GenerateContentConfig — has imageConfig?: ImageConfig
  • ImageConfig — has aspectRatio?: string, imageSize?: string
  • Requires @google/genai >= 1.43.0 for ImageConfig type

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions