From e5d88999cf027247fffa83f5fb053eb5c563069c Mon Sep 17 00:00:00 2001 From: "juancarlos.cavero" Date: Fri, 17 Jul 2026 19:44:16 +0200 Subject: [PATCH] config: default all Gemini text/analysis calls to gemini-3.1-flash-lite MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Unified via GEMINI_MODEL (plus per-task overrides GEMINI_MODEL_EDITOR / GEMINI_MODEL_SAAS / GEMINI_MODEL_THUMBNAIL). The thumbnail image model stays on gemini-3.1-flash-image-preview — flash-lite cannot generate images. --- editor.py | 2 +- main.py | 3 +-- saasshorts.py | 2 +- thumbnail.py | 10 +++++++--- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/editor.py b/editor.py index 3bfdc27..59dff8a 100644 --- a/editor.py +++ b/editor.py @@ -29,7 +29,7 @@ class VideoEditor: self.model_name = ( os.environ.get("GEMINI_MODEL_EDITOR") or os.environ.get("GEMINI_MODEL") - or "gemini-3-flash-preview" + or "gemini-3.1-flash-lite" ) def upload_video(self, video_path): diff --git a/main.py b/main.py index 50968a8..3309569 100644 --- a/main.py +++ b/main.py @@ -810,8 +810,7 @@ def get_viral_clips(transcript_result, video_duration): client = genai.Client(api_key=api_key) - # We use gemini-2.5-flash as requested. - model_name = 'gemini-2.5-flash' + model_name = os.environ.get("GEMINI_MODEL") or 'gemini-3.1-flash-lite' print(f"🤖 Initializing Gemini with model: {model_name}") diff --git a/saasshorts.py b/saasshorts.py index 5d2c285..5e27074 100644 --- a/saasshorts.py +++ b/saasshorts.py @@ -37,7 +37,7 @@ DEFAULT_VOICES = { } -GEMINI_MODEL = "gemini-3-flash-preview" +GEMINI_MODEL = os.environ.get("GEMINI_MODEL_SAAS") or os.environ.get("GEMINI_MODEL") or "gemini-3.1-flash-lite" # ═══════════════════════════════════════════════════════════════════════ diff --git a/thumbnail.py b/thumbnail.py index e9cd4d5..8909e09 100644 --- a/thumbnail.py +++ b/thumbnail.py @@ -4,6 +4,10 @@ import time import json from google import genai from google.genai import types + +# Text/analysis model (title, description, tags). The image model below stays +# on gemini-3.1-flash-image-preview — flash-lite cannot generate images. +TEXT_MODEL = os.environ.get("GEMINI_MODEL_THUMBNAIL") or os.environ.get("GEMINI_MODEL") or "gemini-3.1-flash-lite" from PIL import Image @@ -65,7 +69,7 @@ OUTPUT JSON: print("🤖 [Thumbnail] Asking Gemini for title suggestions...") response = client.models.generate_content( - model="gemini-2.5-flash", + model=TEXT_MODEL, contents=[file_upload, prompt], config=types.GenerateContentConfig( response_mime_type="application/json" @@ -143,7 +147,7 @@ OUTPUT JSON: }}""" response = client.models.generate_content( - model="gemini-2.5-flash", + model=TEXT_MODEL, contents=[prompt], config=types.GenerateContentConfig( response_mime_type="application/json" @@ -322,7 +326,7 @@ OUTPUT: Return ONLY the description text (no JSON wrapper, no markdown code bloc print("🤖 [Thumbnail] Generating YouTube description with chapters...") response = client.models.generate_content( - model="gemini-2.5-flash", + model=TEXT_MODEL, contents=[prompt], )