PARAS MADAN
All writing

Latest in AI

Google Gen AI Python SDK 3.0: Fix Model-Not-Found and HTTP Client Errors

Two changed defaults can break an unchanged Gemini application, so isolate the API version before changing your model or transport.

Google Gen AI Python SDK 3.0 changes both the default Gemini Developer API version and the underlying HTTP client. If an unchanged application starts failing after upgrading, check those two settings separately before replacing the model or rewriting your request code.

The 3.0.0 release notes are dated November 5, with the GitHub release published November 6. This guide covers the documented migration behavior, not results from a live API test.

Start with the installed version

Run these commands in the same environment that runs your application, rather than a different terminal environment or notebook kernel:

python --version
python -m pip show google-genai
python -m pip check

The versioned package configuration requires Python 3.11 or newer and makes httpx2 a required dependency. httpx is now an optional extra. A successful installation therefore does not establish that your application still has the same dependencies or request behavior as before.

Keep the previous lockfile available. My recommendation is to change one setting at a time in staging, record the exact error, and repeat the smallest request your application normally makes. Changing the model, API version and transport together makes a successful retry much less informative.

Fix a model alias that stopped resolving

Developer API clients now default to v1, previously v1beta. Google specifically identifies three aliases that exist on v1beta but not v1: gemini-flash-latest, gemini-flash-lite-latest and gemini-pro-latest.

An API-version mismatch can look like a missing model. If your application uses one of those aliases, explicitly select the beta endpoint before concluding that Google retired the model:

from google import genai
from google.genai import types

client = genai.Client(
    http_options=types.HttpOptions(api_version="v1beta")
)

This assumes your existing authentication is already configured. It creates a client with an explicit endpoint version; it does not make an inference request or verify account access.

Alternatively, set the version in the environment that starts the application:

export GOOGLE_GENAI_API_VERSION=v1beta

The 3.0.0 SDK README confirms that an explicit HttpOptions version overrides the environment variable. If an environment change seems ineffective, inspect the client constructor and any wrapper that supplies its options.

You can also use GOOGLE_GENAI_API_VERSION=beta, which selects the appropriate beta version for the chosen backend. Enterprise/Vertex clients retain their v1beta1 default, so this particular default-version change does not explain every Vertex failure.

For a longer-term migration, choose a specific supported model version on your intended endpoint and evaluate it separately. Restoring v1beta addresses the documented alias mismatch; it cannot fix an incorrect model name, missing access or a retired model.

Restore httpx without changing everything else

If the application imports httpx, passes custom transport objects or catches transport exceptions, the new default deserves a separate check. To reproduce version 3.0.0 while explicitly choosing the previous HTTP backend:

python -m pip install "google-genai[httpx]==3.0.0"
export GOOGLE_GENAI_HTTP_CLIENT=httpx

Set the variable before starting the Python process. This is a version-specific diagnostic configuration, not a recommendation to remain on 3.0.0 indefinitely.

Installing the extra alone does not switch the default transport. It makes httpx available; the environment setting selects it. Google also documents injecting an httpx.Client or httpx.AsyncClient through HttpOptions when an application needs direct control.

If you keep httpx2, audit package-specific objects and exception handlers together. Timeout objects, connection limits, mock transports and authentication subclasses need to match the active backend. Otherwise a test suite built around the old transport can stop representing what production actually uses.

Check certificate handling before disabling verification

The transport-change commit documents another difference: when SSL_CERT_FILE and SSL_CERT_DIR are unset, httpx2 uses the operating system certificate trust store rather than certifi. A corporate proxy or container with different trusted certificates is therefore worth checking if TLS failures appear after the upgrade.

Compare the deployment's certificate configuration with its previous working environment. Do not solve a certificate failure by turning off verification. That removes a security check without explaining which trust configuration the application needs.

Make the upgrade reproducible

Before rollout, repeat representative sync and async requests, streaming if used, and your timeout and proxy tests with explicit configuration. A successful text response alone does not exercise all those paths.

The useful lesson from this release is that an SDK upgrade can change where requests go and how they travel without changing application code. Pinning dependencies helps, but production compatibility also needs explicit API-version and transport decisions.

I’m Paras. I work at the intersection of AI, engineering and distribution.

I help technical teams turn API changes and engineering decisions into clear writing developers can actually use.

Book a 30-minute call.