We use the Gemini API for photo editing and recently switched from Nano Banana 2.0 to Nano Banana 2.1 (gemini-nano-banana-2.1).
We processed thousands of photos with 2.0 without encountering this issue. Since moving to 2.1, we’re seeing intermittent responses with:
finishReason: MAX_TOKENS
These responses return no usable image, even though the reported output and thinking-token usage is substantially below our explicitly configured output limit.
Example from production
Time: October 7, 2026, approximately 6:45:36 PM US Eastern
Method: models.generateContent using the Google Gen AI JavaScript SDK
Model: gemini-nano-banana-2.1
Input: One 3840 × 2880 photo, plus editing instructions
Relevant request configuration:
{
"temperature": 0,
"topP": 0.95,
"responseModalities": ["IMAGE"],
"maxOutputTokens": 32768,
"thinkingConfig": {
"thinkingLevel": "HIGH"
},
"imageConfig": {
"imageSize": "2K",
"aspectRatio": "4:3"
}
}
Relevant response fields captured by our diagnostics:
{
"finishReason": "MAX_TOKENS",
"promptTokenCount": 4958,
"candidatesTokenCount": 1354,
"thoughtsTokenCount": 3972
}
The reported candidate and thinking tokens total 5,326, or approximately 16% of the configured 32,768 output limit. The input tokens are separate from that output budget.
The candidate had no usable content/image, so our application treated the edit as failed. The next retry succeeded. Most edits complete normally; this is intermittent rather than a consistent failure for a particular image.
Questions for the team
-
Why would this request finish with
MAX_TOKENSwhen reported output plus thinking usage is only 5,326 against an explicit 32,768 ceiling? Is there a separate internal thinking/image-generation limit, or does the returned usage omit some tokens relevant to that limit? -
Is this a known change or regression in Nano Banana 2.1? We did not encounter this failure mode with 2.0 across thousands of processed photos.
-
Are these no-image responses billed? Your billing FAQ says requests that fail with HTTP 400 or 500 errors aren’t charged. This case instead returns a model response with
MAX_TOKENSand usage metadata, but no usable result. Are the input, thinking, and candidate tokens still charged, and how are candidate tokens classified when no image is returned? -
What mitigation do you recommend? We already explicitly set the documented 32,768 output ceiling. Is retrying the recommended approach, or is there another setting that addresses this without reducing editing quality?
We added these diagnostics specifically to distinguish actual output-budget exhaustion from other failures. We’re not assuming the finish reason is incorrect, but the reported usage doesn’t appear to explain it.
Happy to provide additional sanitized request/response details privately if helpful.