Issue Summary
The imageSize: '2K' parameter in imageConfig is completely ignored when using the @google/genai JavaScript SDK, but the same setting works correctly in Google AI Studio web interface.
Environment
- SDK:
@google/genaiversion0.14.0(also tested with latest1.31.0) - Model:
gemini-3-pro-image-preview - Platform: Node.js / Browser (React + Vite)
- Use case: E-commerce product photo generation
Expected Behavior
When setting imageSize: '2K', output images should be approximately 2048Γ2048 pixels (or proportional for other aspect ratios like 3:4 β ~1536Γ2048).
Actual Behavior
- SDK returns images at ~896Γ1200 pixels regardless of
imageSizesetting - The same prompt in AI Studio web interface correctly generates 2K images
- No error messages or warnings are returned
Code Example
import { GoogleGenAI } from '@google/genai';
const ai = new GoogleGenAI({ apiKey: 'YOUR_API_KEY' });
const response = await ai.models.generateContent({
model: 'gemini-3-pro-image-preview',
contents: [
{ text: 'A professional fashion photo of a model wearing a blue jacket, studio lighting' }
],
config: {
responseModalities: ['TEXT', 'IMAGE'],
imageConfig: {
aspectRatio: '3:4',
imageSize: '2K' // β This is being IGNORED
}
}
});
// Result: Image is ~896Γ1200 instead of expected ~1536Γ2048
What Iβve Verified
Using uppercase βKβ in imageSize: '2K'(not lowercase)
Using contentsas flat array (not{ parts }object)
responseModalities: ['TEXT', 'IMAGE']is set correctly
Tested with multiple aspect ratios (1:1, 3:4, 16:9) - same issue
Tested with both simple text prompts and image-to-image workflows
AI Studio generates 2K images with identical settings
Key Observation
The same configuration that fails in the SDK works correctly in AI Studio. This suggests the issue is specific to the JavaScript SDK, not the underlying API.
Questions
- Is there a known issue with
imageSizeparameter in the JS SDK? - Is there a different syntax required for the SDK vs REST API?
- Is there an ETA for a fix?
Impact
This limitation prevents using the SDK for high-quality e-commerce product photography workflows where 2K resolution is required.
Thank you for any insights!