Skip to content

gemini-3.1-flash-image (GA) ignores imageConfig.imageSize on Vertex AI — always returns 1K #1682

@EdamH

Description

@EdamH

Description

The GA model gemini-3.1-flash-image silently ignores imageConfig.imageSize when called via the Vertex AI endpoint. All requests return ~512×2064 output (1K resolution) regardless of
whether imageSize is set to "1K", "2K", or "4K".

The preview model (gemini-3.1-flash-image-preview) respects imageSize correctly using the identical request on the same project and endpoint.

This is similar to #1461 but affects the GA model, not the preview.

Environment

  • SDK: @google/genai@2.8.0 (also reproduced with 1.39.0)
  • Endpoint: Vertex AI (vertexai: true)
  • Project location: global
  • Node.js: v25.6.1
  • OS: macOS Darwin 25.3.0

Reproduction

1. Via SDK (@google/genai)

import { GoogleGenAI } from '@google/genai';

const client = new GoogleGenAI({ vertexai: true, project: 'my-project', location: 'global' });

const response = await client.models.generateContent({
  model: 'gemini-3.1-flash-image',  // GA model
  contents: [{ role: 'user', parts: [{ text: 'Generate a tall narrow product image (1:4 ratio)' }] }],
  config: {
    responseModalities: ['TEXT', 'IMAGE'],
    imageConfig: { imageSize: '4K' },
  },
});
// Output: always ~512×2064 regardless of imageSize

2. Via raw REST (bypassing SDK entirely)

curl -X POST \
  "https://aiplatform.googleapis.com/v1/projects/MY_PROJECT/locations/global/publishers/google/models/gemini-3.1-flash-image:generateContent" \
  -H "Authorization: Bearer $(gcloud auth print-access-token)" \
  -H "Content-Type: application/json" \
  -d '{
    "contents": [{"role": "user", "parts": [{"text": "Generate a tall product image"}]}],
    "generationConfig": {
      "responseModalities": ["TEXT", "IMAGE"],
      "imageConfig": {"imageSize": "4K"}
    }
  }'
// Output: always ~512×2064

Test Results

GA Model (gemini-3.1-flash-image) — imageSize Ignored

imageSize Output Width Output Height
1K 512 2064
2K 512 2064
4K 512 2064

Preview Model (gemini-3.1-flash-image-preview) — imageSize Respected

imageSize Output Width Output Height
1K 512 2064
2K 1024 4128
4K 2048 8256

Additional Findings

  • Reproduced with both @google/genai@1.39.0 and @2.8.0 — same results.
  • Reproduced via raw HTTP (no SDK) — confirms the issue is server-side, not SDK serialization.
  • responseFormat.image.imageSize (from Gemini Developer API docs) returns HTTP 400 on Vertex AI: "Unknown name "responseFormat" at 'generation_config': Cannot find field" — so this
    format is not supported on Vertex.
  • The preview model sunset is June 25, 2026, making this a blocker for migration to GA.

Expected Behavior

imageConfig.imageSize should control output resolution for the GA model, matching the preview model's behavior.


Metadata

Metadata

Assignees

Labels

api: vertex-aiIssues related to the Vertex AI API.priority: p2Moderately-important priority. Fix may not be included in next release.status:awaiting user responseissues requiring a response from the usertype: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions