Environment details
- SDK:
@google/genai v1.45.0 and v1.48.0 (tested both, same behavior)
- Endpoint: Vertex AI (
vertexai: true, API version v1beta1)
- Location:
global
- Platform: Node.js 20, Cloud Run (europe-west1)
Summary
gemini-3.1-flash-image-preview silently ignores the imageConfig.imageSize parameter in generateContent requests. The model always produces ~1K resolution output (928x1152) regardless of whether imageSize is set to "2K" or "4K".
The same code path works correctly with gemini-3-pro-image-preview, which respects imageSize and produces 4K output as expected.
Steps to reproduce
import { GoogleGenAI } from '@google/genai';
const client = new GoogleGenAI({ vertexai: true, project: 'my-project', location: 'global' });
const result = await client.models.generateContent({
model: 'gemini-3.1-flash-image-preview',
config: {
responseModalities: ['TEXT', 'IMAGE'],
imageConfig: {
imageSize: '2K', // Also tried '4K' — same result
},
temperature: 0.4,
},
contents: [
{
role: 'user',
parts: [
{ text: 'A product photo of a dress on a model' },
{ inlineData: { data: '<base64_image>', mimeType: 'image/png' } },
],
},
],
});
// Result: image is always ~1K (928x1152), never 2K or 4K
Expected behavior
Output image should match the requested imageSize:
"2K" → largest dimension ~2048px
"4K" → largest dimension ~4096px
Per Google's documentation: "Gemini 3 image models generate 1K images by default but can also output 2K, 4K, and 512 (0.5K) images."
The model page also lists "New support for 0.5K, 2K and 4K" as a feature.
Actual behavior
Output is always ~1K (928x1152) regardless of imageSize value. No error is returned — the parameter is silently ignored.
Comparison with gemini-3-pro-image-preview
Using the exact same code with model: 'gemini-3-pro-image-preview' produces correct 4K output. This confirms:
- The SDK correctly serializes
imageConfig.imageSize into the request
- The Vertex AI endpoint accepts the parameter
- The issue is specific to
gemini-3.1-flash-image-preview
Verification
We inspected the SDK source and confirmed that imageConfigToVertex in @google/genai correctly maps imageSize to generationConfig.imageConfig.imageSize in the Vertex AI REST request body. The transformation function is identical between SDK v1.45.0 and v1.48.0 — this is not an SDK serialization issue.
Impact
Users requesting 2K or 4K resolution receive 1K output without any error indication.
Environment details
@google/genaiv1.45.0 and v1.48.0 (tested both, same behavior)vertexai: true, API versionv1beta1)globalSummary
gemini-3.1-flash-image-previewsilently ignores theimageConfig.imageSizeparameter ingenerateContentrequests. The model always produces ~1K resolution output (928x1152) regardless of whetherimageSizeis set to"2K"or"4K".The same code path works correctly with
gemini-3-pro-image-preview, which respectsimageSizeand produces 4K output as expected.Steps to reproduce
Expected behavior
Output image should match the requested
imageSize:"2K"→ largest dimension ~2048px"4K"→ largest dimension ~4096pxPer Google's documentation: "Gemini 3 image models generate 1K images by default but can also output 2K, 4K, and 512 (0.5K) images."
The model page also lists "New support for 0.5K, 2K and 4K" as a feature.
Actual behavior
Output is always ~1K (928x1152) regardless of
imageSizevalue. No error is returned — the parameter is silently ignored.Comparison with
gemini-3-pro-image-previewUsing the exact same code with
model: 'gemini-3-pro-image-preview'produces correct 4K output. This confirms:imageConfig.imageSizeinto the requestgemini-3.1-flash-image-previewVerification
We inspected the SDK source and confirmed that
imageConfigToVertexin@google/genaicorrectly mapsimageSizetogenerationConfig.imageConfig.imageSizein the Vertex AI REST request body. The transformation function is identical between SDK v1.45.0 and v1.48.0 — this is not an SDK serialization issue.Impact
Users requesting 2K or 4K resolution receive 1K output without any error indication.