[PR #209] [CLOSED] feat: add ImageMode for image quality selection(Nano Banana Pro Support) #218

Closed
opened 2026-02-13 17:28:07 -06:00 by mirrors · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/HanaokaYuzu/Gemini-API/pull/209
Author: @seolcoding
Created: 1/10/2026
Status: Closed

Base: masterHead: feat/image-mode-api


📝 Commits (1)

  • aa33ef4 feat: add ImageMode API for image quality selection

📊 Changes

3 files changed (+76 additions, -23 deletions)

View changed files

📝 src/gemini_webapi/__init__.py (+1 -0)
📝 src/gemini_webapi/client.py (+63 -23)
📝 src/gemini_webapi/constants.py (+12 -0)

📄 Description

Summary

Enable Nano Banana Pro mode for high-quality image generation via new ImageMode parameter.

This PR unlocks the Nano Banana Pro model (Google's higher quality image generation) which was previously not accessible through the API.

  • ImageMode.PRO (default): High quality image generation using Nano Banana Pro model
  • ImageMode.FAST: Standard quality, faster response (previous default behavior)

How Nano Banana Pro is Triggered

Through reverse engineering the Gemini web interface, I discovered the following parameters:

  1. Header extension: x-goog-ext-525001261-jspb with model signature 9d8ca3786ebdfbea
  2. Payload parameters: idx17=[[1]] (quality marker) + idx49=14 (Pro flag)

These parameters activate the Nano Banana Pro model, resulting in significantly higher quality generated images.

Usage

from gemini_webapi import GeminiClient, ImageMode

# Pro mode (default) - high quality images
response = await client.generate_content("Generate a picture of a cat")

# Fast mode - faster generation
response = await client.generate_content(
    "Generate a picture of a cat",
    image_mode=ImageMode.FAST
)

# String input also supported
response = await client.generate_content(
    "Generate a picture of a cat",
    image_mode="fast"
)

Changes

  • constants.py: Add ImageMode enum
  • __init__.py: Export ImageMode
  • client.py: Implement image_mode parameter in generate_content()

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/HanaokaYuzu/Gemini-API/pull/209 **Author:** [@seolcoding](https://github.com/seolcoding) **Created:** 1/10/2026 **Status:** ❌ Closed **Base:** `master` ← **Head:** `feat/image-mode-api` --- ### 📝 Commits (1) - [`aa33ef4`](https://github.com/HanaokaYuzu/Gemini-API/commit/aa33ef4489682b7592100e1a082315fc5e423ade) feat: add ImageMode API for image quality selection ### 📊 Changes **3 files changed** (+76 additions, -23 deletions) <details> <summary>View changed files</summary> 📝 `src/gemini_webapi/__init__.py` (+1 -0) 📝 `src/gemini_webapi/client.py` (+63 -23) 📝 `src/gemini_webapi/constants.py` (+12 -0) </details> ### 📄 Description ## Summary Enable **Nano Banana Pro** mode for high-quality image generation via new `ImageMode` parameter. This PR unlocks the Nano Banana Pro model (Google's higher quality image generation) which was previously not accessible through the API. - `ImageMode.PRO` (default): High quality image generation using **Nano Banana Pro** model - `ImageMode.FAST`: Standard quality, faster response (previous default behavior) ## How Nano Banana Pro is Triggered Through reverse engineering the Gemini web interface, I discovered the following parameters: 1. **Header extension**: `x-goog-ext-525001261-jspb` with model signature `9d8ca3786ebdfbea` 2. **Payload parameters**: `idx17=[[1]]` (quality marker) + `idx49=14` (Pro flag) These parameters activate the Nano Banana Pro model, resulting in significantly higher quality generated images. ## Usage ```python from gemini_webapi import GeminiClient, ImageMode # Pro mode (default) - high quality images response = await client.generate_content("Generate a picture of a cat") # Fast mode - faster generation response = await client.generate_content( "Generate a picture of a cat", image_mode=ImageMode.FAST ) # String input also supported response = await client.generate_content( "Generate a picture of a cat", image_mode="fast" ) ``` ## Changes - `constants.py`: Add `ImageMode` enum - `__init__.py`: Export `ImageMode` - `client.py`: Implement `image_mode` parameter in `generate_content()` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
mirrors 2026-02-13 17:28:07 -06:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
mirrors/Gemini-API#218
No description provided.