Problem
gemini-3-pro-image-preview appears to be persisting visual context (composition, style, color palette) across completely separate API sessions, even though:
- Each request is a fresh API call (not a chat continuation)
- I never reuse conversation history
- I added
systemInstructionexplicitly instructing context reset - I’m using the official
@google/genaiTypeScript SDK
This behavior suggests some form of server-side context/state persistence that contradicts the expected stateless nature of individual API calls, and I have this issue in the Google AI Studio playground as well.
Environment
- Model:
gemini-3-pro-image-preview - SDK:
@google/genai(latest) - Platform: Node.js (server-side)
- API Method:
ai.models.generateContentStream()
Code Example
Here’s our exact implementation pattern:
import { GoogleGenAI } from '@google/genai';
const ai = new GoogleGenAI({
apiKey: process.env.GEMINI_API_KEY,
});
// Each request uses a completely fresh config and contents array
const config = {
responseModalities: ['IMAGE'],
imageConfig: {
aspectRatio: '1:1',
imageSize: '2K',
},
systemInstruction: [
{
text: `# CRITICAL INSTRUCTION: HARD IMAGE CONTEXT RESET
Every prompt you receive, even in a continuous chat session, must be treated as a brand-new, single-turn request.
1. **ABSOLUTE WIPE:** You must completely discard all conversational history, visual references, generated images, and stylistic elements from **all prior turns** of this chat, and any other temporary chats.
2. **NO REUSE:** Do not repeat the composition, subject, color palette, or specific style of the last generated image unless the current prompt explicitly demands a continuity element.
3. **FRESH START:** Begin the image generation process from a blank slate using only the information contained within the user's *most recent* prompt.
4. **CONFIRMATION (Internal):** Before generating, internally confirm that the context has been reset.`
}
],
};
// Fresh contents array - no history, no prior messages
const contents = [
{
inlineData: {
mimeType: 'image/jpeg',
data: base64Image, // Different product image each time
},
},
{
text: userPrompt, // Different prompt each time
},
];
// Completely new API call each time
const response = await ai.models.generateContentStream({
model: 'gemini-3-pro-image-preview',
contents: contents,
config: config,
});
Here my questions, please help
-
Is there server-side context/state persistence in
gemini-3-pro-image-previewthat carries across API sessions? -
Does
systemInstructionactually affect image generation behavior, or is it only processed for text responses? -
Is there a way to force a true “cold start” with no prior context influence?
-
Is this expected behavior for the image preview model, or is this a bug?
-
Are there any undocumented parameters that control context isolation for image generation?