I’m using the google-genai python library integrated with my API but it takes ~5-10m to respond. I created a test file in case it was a problem with my API but i get the same thing, with both 2.5 flash and pro.
Here’s my test code:
import os
import logging
import time
import google.genai as genai
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
PROJECT_ID = "myprojectid-123456"
REGION = "region-a3"
CREDENTIALS_PATH = "google-credentials.json"
os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = CREDENTIALS_PATH
logger.info("⏱️ Starting timer...")
start = time.perf_counter()
logger.info("Initializing genai.Client...")
client = genai.Client(vertexai=True, project=PROJECT_ID, location=REGION)
logger.info("Calling generate_content...")
response = client.models.generate_content(
model="gemini-2.5-flash",
contents="WHats your favorite bankai?"
)
elapsed = time.perf_counter() - start
logger.info(f"✅ Test successful in {elapsed:.2f} seconds")
logger.info(f"Response: {response.text}")
This test prompt is very short so i don’t think its because of my prompt. Let me know if i’m doing anything wrong