How do I specify the gemini3-pro(nano banana pro) model to generate images? #116

Open
opened 2026-02-13 17:27:52 -06:00 by mirrors · 3 comments
Owner

Originally created by @xufuzhi on GitHub (Dec 3, 2025).

When I try to specify gemini3-pro to generate an image using the code below:

input_imgs = [Path('/home/jm/Downloads/IMG_20250602_075441005_HDR.jpg'),
              '/home/jm/Downloads/20250929-165042.png',
              '/home/jm/Downloads/20251017-161217.png',
              ]
response = await client.generate_content(
    "Put sunglasses on this cat,
    files=input_imgs, model=Model.G_3_0_PRO)

I get an error:

2025-12-03 09:36:04.955 | DEBUG    | gemini_webapi.utils.get_access_token:get_access_token:168 - Skipping loading local browser cookies. Optional dependency 'browser-cookie3' is not installed.
2025-12-03 09:36:07.474 | DEBUG    | gemini_webapi.utils.get_access_token:get_access_token:186 - Init attempt (1/2) succeeded. Initializing client...
2025-12-03 09:36:07.498 | SUCCESS  | gemini_webapi.client:init:173 - Gemini client initialized successfully.
2025-12-03 09:36:09.254 | DEBUG    | gemini_webapi.client:start_auto_refresh:234 - Cookies refreshed. New __Secure-1PSIDTS applied.
2025-12-03 09:36:59.729 | DEBUG    | gemini_webapi.utils.parsing:get_nested_value:32 - Safe navigation: path [4] ended at index 0 (key '4'), returning default. <Debug: IndexError; Context: [None, ['c_c5a5574e39c64e01', 'r_701f5f03915d7324'], {'7': [None, ['data_analysis_tool', [None, None, ''], 1, [None, [None, None, None, None, None, None, None, [19]], False]]], '44': False}]>
2025-12-03 09:36:59.729 | DEBUG    | gemini_webapi.utils.parsing:get_nested_value:32 - Safe navigation: path [4] ended at index 0 (key '4'), returning default. <Debug: IndexError; Context: [None, ['c_c5a5574e39c64e01', 'r_701f5f03915d7324'], {'7': [None, ['data_analysis_tool', [None, None, ''], 4, [None, [None, None, None, None, None, None, None, [19]], False]]], '44': False}]>
2025-12-03 09:36:59.729 | DEBUG    | gemini_webapi.utils.parsing:get_nested_value:32 - Safe navigation: path [4] ended at index 0 (key '4'), returning default. <Debug: IndexError; Context: [None, ['c_c5a5574e39c64e01', 'r_701f5f03915d7324'], {'7': [None, ['data_analysis_tool', [None, None, ''], 1, [None, [None, None, None, None, None, None, None, [19]], False]]], '44': False}]>
2025-12-03 09:36:59.729 | DEBUG    | gemini_webapi.utils.parsing:get_nested_value:32 - Safe navigation: path [4] ended at index 0 (key '4'), returning default. <Debug: IndexError; Context: [None, ['c_c5a5574e39c64e01', 'r_701f5f03915d7324'], {'7': [None, ['data_analysis_tool', [None, None, ''], 4, [None, [None, None, None, None, None, None, None, [19]], False]]], '44': False}]>
2025-12-03 09:36:59.729 | DEBUG    | gemini_webapi.utils.parsing:get_nested_value:32 - Safe navigation: path [4] ended at index 0 (key '4'), returning default. <Debug: IndexError; Context: [None, ['c_c5a5574e39c64e01', 'r_701f5f03915d7324'], {'7': [None, ['data_analysis_tool', [None, None, ''], 4, [None, [None, None, None, None, None, None, None, [19]], False]]], '44': False}]>
2025-12-03 09:36:59.729 | DEBUG    | gemini_webapi.utils.parsing:get_nested_value:32 - Safe navigation: path [4] ended at index 0 (key '4'), returning default. <Debug: IndexError; Context: [None, ['c_c5a5574e39c64e01', 'r_701f5f03915d7324'], {'7': [None, None, None, None, None, ['Finalizing Image Checklist']], '44': False}]>
2025-12-03 09:36:59.729 | DEBUG    | gemini_webapi.utils.parsing:get_nested_value:32 - Safe navigation: path [12, 1] ended at index 1 (key '1'), returning default. <Debug: IndexError; Context: [{'7': [3], '8': [[[[None, None, None, [None, 1, '11653957400412845756.png', 'https://lh3.googleusercontent.com/gg-dl/ABS2GSkJCld-1szqTpPcPVdjPYE6laPaEv_sIRKRjtD5NyfdtrLFheOlEO9B0M6insEua-fjkffwmP-...>
2025-12-03 09:36:59.729 | DEBUG    | gemini_webapi.utils.parsing:get_nested_value:32 - Safe navigation: path [12, 7, 0] ended at index 1 (key '7'), returning default. <Debug: IndexError; Context: [{'7': [3], '8': [[[[None, None, None, [None, 1, '11653957400412845756.png', 'https://lh3.googleusercontent.com/gg-dl/ABS2GSkJCld-1szqTpPcPVdjPYE6laPaEv_sIRKRjtD5NyfdtrLFheOlEO9B0M6insEua-fjkffwmP-...>

I know that generating the image works correctly when using the default model:

response = await client.generate_content(
    "Put sunglasses on this cat,
    files=input_imgs)

But the default model doesn't use the "nano banana pro"(which I assume is gemini3-pro), so the image quality it generates isn't that great.

Is there any way to specify Gemini3-Pro (Nano Banana Pro) to generate images?

Thank you very much!

Originally created by @xufuzhi on GitHub (Dec 3, 2025). When I try to specify gemini3-pro to generate an image using the code below: ~~~ input_imgs = [Path('/home/jm/Downloads/IMG_20250602_075441005_HDR.jpg'), '/home/jm/Downloads/20250929-165042.png', '/home/jm/Downloads/20251017-161217.png', ] response = await client.generate_content( "Put sunglasses on this cat, files=input_imgs, model=Model.G_3_0_PRO) ~~~ I get an error: ~~~ 2025-12-03 09:36:04.955 | DEBUG | gemini_webapi.utils.get_access_token:get_access_token:168 - Skipping loading local browser cookies. Optional dependency 'browser-cookie3' is not installed. 2025-12-03 09:36:07.474 | DEBUG | gemini_webapi.utils.get_access_token:get_access_token:186 - Init attempt (1/2) succeeded. Initializing client... 2025-12-03 09:36:07.498 | SUCCESS | gemini_webapi.client:init:173 - Gemini client initialized successfully. 2025-12-03 09:36:09.254 | DEBUG | gemini_webapi.client:start_auto_refresh:234 - Cookies refreshed. New __Secure-1PSIDTS applied. 2025-12-03 09:36:59.729 | DEBUG | gemini_webapi.utils.parsing:get_nested_value:32 - Safe navigation: path [4] ended at index 0 (key '4'), returning default. <Debug: IndexError; Context: [None, ['c_c5a5574e39c64e01', 'r_701f5f03915d7324'], {'7': [None, ['data_analysis_tool', [None, None, ''], 1, [None, [None, None, None, None, None, None, None, [19]], False]]], '44': False}]> 2025-12-03 09:36:59.729 | DEBUG | gemini_webapi.utils.parsing:get_nested_value:32 - Safe navigation: path [4] ended at index 0 (key '4'), returning default. <Debug: IndexError; Context: [None, ['c_c5a5574e39c64e01', 'r_701f5f03915d7324'], {'7': [None, ['data_analysis_tool', [None, None, ''], 4, [None, [None, None, None, None, None, None, None, [19]], False]]], '44': False}]> 2025-12-03 09:36:59.729 | DEBUG | gemini_webapi.utils.parsing:get_nested_value:32 - Safe navigation: path [4] ended at index 0 (key '4'), returning default. <Debug: IndexError; Context: [None, ['c_c5a5574e39c64e01', 'r_701f5f03915d7324'], {'7': [None, ['data_analysis_tool', [None, None, ''], 1, [None, [None, None, None, None, None, None, None, [19]], False]]], '44': False}]> 2025-12-03 09:36:59.729 | DEBUG | gemini_webapi.utils.parsing:get_nested_value:32 - Safe navigation: path [4] ended at index 0 (key '4'), returning default. <Debug: IndexError; Context: [None, ['c_c5a5574e39c64e01', 'r_701f5f03915d7324'], {'7': [None, ['data_analysis_tool', [None, None, ''], 4, [None, [None, None, None, None, None, None, None, [19]], False]]], '44': False}]> 2025-12-03 09:36:59.729 | DEBUG | gemini_webapi.utils.parsing:get_nested_value:32 - Safe navigation: path [4] ended at index 0 (key '4'), returning default. <Debug: IndexError; Context: [None, ['c_c5a5574e39c64e01', 'r_701f5f03915d7324'], {'7': [None, ['data_analysis_tool', [None, None, ''], 4, [None, [None, None, None, None, None, None, None, [19]], False]]], '44': False}]> 2025-12-03 09:36:59.729 | DEBUG | gemini_webapi.utils.parsing:get_nested_value:32 - Safe navigation: path [4] ended at index 0 (key '4'), returning default. <Debug: IndexError; Context: [None, ['c_c5a5574e39c64e01', 'r_701f5f03915d7324'], {'7': [None, None, None, None, None, ['Finalizing Image Checklist']], '44': False}]> 2025-12-03 09:36:59.729 | DEBUG | gemini_webapi.utils.parsing:get_nested_value:32 - Safe navigation: path [12, 1] ended at index 1 (key '1'), returning default. <Debug: IndexError; Context: [{'7': [3], '8': [[[[None, None, None, [None, 1, '11653957400412845756.png', 'https://lh3.googleusercontent.com/gg-dl/ABS2GSkJCld-1szqTpPcPVdjPYE6laPaEv_sIRKRjtD5NyfdtrLFheOlEO9B0M6insEua-fjkffwmP-...> 2025-12-03 09:36:59.729 | DEBUG | gemini_webapi.utils.parsing:get_nested_value:32 - Safe navigation: path [12, 7, 0] ended at index 1 (key '7'), returning default. <Debug: IndexError; Context: [{'7': [3], '8': [[[[None, None, None, [None, 1, '11653957400412845756.png', 'https://lh3.googleusercontent.com/gg-dl/ABS2GSkJCld-1szqTpPcPVdjPYE6laPaEv_sIRKRjtD5NyfdtrLFheOlEO9B0M6insEua-fjkffwmP-...> ~~~ I know that generating the image works correctly when using the default model: ~~~ response = await client.generate_content( "Put sunglasses on this cat, files=input_imgs) ~~~ But the default model doesn't use the "nano banana pro"(which I assume is gemini3-pro), so the image quality it generates isn't that great. Is there any way to specify Gemini3-Pro (Nano Banana Pro) to generate images? Thank you very much!
Author
Owner

@FB208 commented on GitHub (Jan 9, 2026):

I encountered the same problem. When both the files and model parameters exist, the image cannot be returned.

@FB208 commented on GitHub (Jan 9, 2026): I encountered the same problem. When both the `files` and `model` parameters exist, the image cannot be returned.
Author
Owner

@Luen commented on GitHub (Jan 15, 2026):

Maybe this? https://github.com/HanaokaYuzu/Gemini-API/pull/209

@Luen commented on GitHub (Jan 15, 2026): Maybe this? https://github.com/HanaokaYuzu/Gemini-API/pull/209
Author
Owner

@ashwarsadh commented on GitHub (Jan 29, 2026):

same issue , we cant use latest image model to generate images, as the image cannot be returned.

@ashwarsadh commented on GitHub (Jan 29, 2026): same issue , we cant use latest image model to generate images, as the image cannot be returned.
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#116
No description provided.