Google GenAI SDK 3.0 Upgrade: Fix v1 404s, httpx2, Node 22

The Google GenAI SDK 3.0 upgrade changes one thing that breaks working code without warning: Gemini Developer API clients now call the v1 API instead of v1beta. If you use gemini-flash-latest, a -preview model, the Live API or context caching, pin api_version="v1beta" (or set GOOGLE_GENAI_API_VERSION=v1beta) before you bump the package. Python users also lose httpx as the default HTTP client, and JavaScript users need Node.js 22 or newer.

This guide covers google-genai 3.0.0 for Python (released 2026-11-05) and @google/genai 3.0.0 for JavaScript (released 2026-11-06). Both packages had reached 3.6.1 by 2026-11-18. Every fact below comes from the official GitHub release notes, checked on November 22, 2026. The commands are standard pip, npm and grep calls. I have not run them against your project, so read each output with the decision table below.

What changed in Google GenAI SDK 3.0

Google GenAI SDK 3.0 breaking changes: v1 default API version, httpx2 in Python, Node.js 22 in JavaScript, Interactions result type
The four breaking changes in google-genai and @google/genai 3.0.0
ChangePython google-genaiJS @google/genaiWho breaks
Default API version v1beta → v1YesYesAliases, previews, Live, caches
httpx → httpx2 default clientYes—Code that passes or catches httpx objects
Minimum Node.js 22—YesNode 20 runtimes
CodeExecutionResultStep.result is a unionYesYesInteractions API code reading it as a string

Two details matter more than the headline.

  • Vertex AI is not affected by the default change. Clients created with vertexai=True (or enterprise=True in Python) still default to v1beta1.
  • Some things exist only on v1beta. The release notes name the gemini-flash-latest, gemini-flash-lite-latest and gemini-pro-latest aliases and "some -preview models". They also state that the Live API and context caching (caches) are not available on v1.

The 3.0.0 notes also list "Disable GenerateVideos for Gemini API". If you call generate_videos through the Developer API client, test that path before you upgrade.

Check your environment before the upgrade

Four read-only checks before upgrading to Google GenAI SDK 3.0: SDK version, model names, Live API and caches, httpx and Node version
Run these four checks from the project root before you change any version

1. Which SDK version do you have?

Python:

pip show google-genai | grep -i '^version'
python -c "import importlib.metadata as m; print(m.version('google-genai'))"

JavaScript:

npm ls @google/genai
node -v

How to read the output:

  • 2.x: nothing has changed yet, but a loose range like google-genai>=2 or "@google/genai": "*" will pull 3.x on the next install.
  • 3.x: the v1 default is already active unless you set a version in code or in the environment.
  • node -v prints v20.x: @google/genai 3.x declares engines.node >=22.0.0.

Check your lock file too. Dependabot and Renovate opened bump PRs from 2.x to 3.0.0 in many public repositories in early November.

2. Do you use a model that only exists on v1beta?

grep -rnE "gemini-(flash|flash-lite|pro)-latest|-preview" \
  --include=*.py --include=*.ts --include=*.js --include=*.env --include=*.yaml .

Any match means you need either v1beta or a stable model ID. Not every -preview model is missing from v1; the release notes say "some". Test each one rather than assuming.

3. Do you use the Live API or context caching?

grep -rnE "\.live\.|\.caches\." --include=*.py --include=*.ts --include=*.js .

Python calls look like client.aio.live.connect(...) and client.caches.create(...). JavaScript calls look like ai.live.connect(...) and ai.caches.create(...). Any match needs v1beta on that client.

4. Python only: do you touch httpx directly?

grep -rnE "import httpx|from httpx|httpx\." --include=*.py .

Matches in code that builds HttpOptions(client_args=...), passes httpx_client=..., or catches httpx.TimeoutException need attention in step 4 below.

Decision table: upgrade now, pin first, or wait

Your setupActionWhen
Vertex AI client only, Node 22+, no httpx objectsUpgradeNow
Developer API, stable model IDs, no Live or cachesUpgrade, then run one test callNow
Uses *-latest aliases or preview modelsPin v1beta or switch model IDs, then upgradeThis week
Uses Live API or cachesPin v1beta on that client, then upgradeThis week
Python code passes or catches httpx objectsChoose httpx2 or keep httpx (step 4)Before upgrade
Node.js 20 runtimeStay on @google/genai@^2 until Node 22Wait
Decision flow for choosing the Gemini API version after the Google GenAI SDK 3.0 upgrade
Which api_version to set after upgrading to google-genai 3.x
View PlantUML source
@startuml
skinparam defaultFontSize 14
start
if (Vertex AI client?) then (yes)
  :default stays v1beta1;
  stop
else (no)
endif
if (Live API or caches?) then (yes)
  :pin v1beta;
  stop
else (no)
endif
if (*-latest alias or preview model?) then (yes)
  if (stable model ID OK?) then (yes)
    :switch model, keep v1;
  else (no)
    :pin v1beta;
  endif
else (no)
  :keep default v1;
endif
stop
@enduml

Pin the API version before upgrading google-genai

Order of priority for the Gemini API version in Google GenAI SDK 3.0: code setting, then GOOGLE_GENAI_API_VERSION, then SDK default
A version set in code beats the environment variable, which beats the SDK default

Set the version explicitly first. Then the package bump changes nothing about which endpoint you call.

Option A: in code (recommended)

Python:

from google import genai
from google.genai import types

client = genai.Client(
    api_key="<YOUR_GEMINI_API_KEY>",
    http_options=types.HttpOptions(api_version="v1beta"),
)

JavaScript / TypeScript:

import { GoogleGenAI } from '@google/genai';

const ai = new GoogleGenAI({
  apiKey: '<YOUR_GEMINI_API_KEY>',
  apiVersion: 'v1beta',
});

The JS release notes say you can pass apiVersion or httpOptions.apiVersion. A value set in code takes precedence over the environment variable.

Option B: environment variable

Use this when you cannot touch the code, such as a third-party tool or a container you only configure:

export GOOGLE_GENAI_API_VERSION=v1beta

Or use beta, which means v1beta on the Developer API and v1beta1 on Vertex AI:

export GOOGLE_GENAI_API_VERSION=beta

In Docker Compose, put it under environment:. In GitHub Actions, put it under env: at the job level. The variable is read only when no version is set in code.

A good split: keep a v1 client for plain text generation and a second client pinned to v1beta for Live and caching. That way you only depend on the beta surface where you need it.

Then upgrade the package

Python (pip, uv, Poetry):

pip install -U "google-genai>=3,<4"
uv add "google-genai>=3,<4"
poetry add "google-genai@^3"

JavaScript:

npm install @google/genai@^3
pnpm add @google/genai@^3

Confirm the result:

pip show google-genai | grep -i '^version'   # expect 3.x
npm ls @google/genai                          # expect 3.x

Then make one real request with each client you configured: a short generate_content call, plus a Live connect or cache create if you use them. A green unit test suite with a mocked client will not catch the v1 change.

The Python SDK's 2.34.0 release (2026-10-29) already dropped Python 3.10. If you skipped that release, check your interpreter version too.

Python: move from httpx to httpx2

Two paths for the Python HTTP client in Google GenAI SDK 3.0: move to httpx2 imports or keep httpx with the extra and GOOGLE_GENAI_HTTP_CLIENT
Pick one path and keep every HTTP object from the same package

In 3.0, httpx2 is the required dependency and the default HTTP client, and httpx is no longer installed by default. If you only call client.models.generate_content(...), you probably do not need to change anything. If you pass HTTP objects into the SDK, pick one of these paths.

Path 1: move to httpx2. The release notes say updating imports is usually enough:

import httpx2 as httpx  # was: import httpx

Everything you pass through HttpOptions(client_args=..., async_client_args=...) must come from the active client's package. That includes Timeout, Limits, transports such as MockTransport, custom Auth subclasses, and the exceptions you catch (TimeoutException, ConnectError, HTTPError).

Path 2: keep httpx. You need both lines:

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

The extra alone only makes import httpx work. If GOOGLE_GENAI_HTTP_CLIENT is unset or auto and the extra is installed, passing httpx objects selects the httpx backend automatically. You can also hand the SDK your own clients:

import httpx
from google import genai
from google.genai import types

client = genai.Client(
    http_options=types.HttpOptions(
        httpx_client=httpx.Client(),
        httpx_async_client=httpx.AsyncClient(),
    )
)

TLS changes with httpx2. httpx2 trusts the operating system certificate store instead of certifi, as long as SSL_CERT_FILE and SSL_CERT_DIR are unset. Behind a TLS-inspecting corporate proxy, this can fix errors you used to work around. On a slim container with no CA bundle, it can create new ones.

JavaScript: Node.js 22 and the Interactions result type

@google/genai 3.x requires Node.js 22 or newer, because Node 20 reached end of life on 2026-04-30. The runtime API and bundles did not change, and both CommonJS and ESM builds are still published. If you must stay on Node 20, pin @google/genai@^2. For the runtime move itself, see How to Upgrade to Node.js 26 LTS from Node 24. It targets a newer line, but the checklist (nvm, Docker base image, CI matrix) is the same.

In both SDKs, CodeExecutionResultStep.result in the Interactions API is now CodeExecutionResultStepResult, typed in TypeScript as Array<Content> | string. Text-only results are still plain strings, so this mostly breaks type checks:

const out = typeof step.result === 'string'
  ? step.result
  : step.result.map(c => JSON.stringify(c)).join('\n');

If you built on the Interactions API for world models, as in our Genie 4 API tutorial, run your type checker after the bump.

Troubleshooting after the upgrade

Troubleshooting map for Google GenAI SDK 3.0: 404 model not found, Live and cache failures, missing httpx module, TLS errors, npm EBADENGINE
Most post-upgrade errors trace back to one of these five causes

A model that worked yesterday now returns 404 / NOT_FOUND. The model is probably an alias or preview that exists only on v1beta. The error looks like a retired model, but the API version is the cause. Pin v1beta, or replace the alias with a stable model ID from the Gemini API models page. Model retirements are a separate issue; see our Gemini preview shutdown guide for how those look.

Live sessions or cached content fail. These are v1beta only on the Developer API. Pin v1beta on the client that uses them.

ModuleNotFoundError: No module named 'httpx'. Your code (or another library) imported httpx and relied on the SDK to install it. Add httpx to your own requirements, or switch to httpx2 imports.

Type or isinstance errors around timeouts and transports. You are mixing httpx.* objects with the httpx2 backend. Use one package everywhere (path 1 or path 2 above).

npm warn EBADENGINE or a failed install with engine-strict. You are on Node 20. Upgrade Node, or pin @google/genai@^2.

Roll back

pip install "google-genai<3"          # Python
npm install @google/genai@^2          # JavaScript

Commit the lock file change, redeploy, and remove any GOOGLE_GENAI_HTTP_CLIENT value you added. The 2.x line accepts api_version in code, so a v1beta pin you added earlier is safe to keep.

FAQ

Does Google GenAI SDK 3.0 change anything on Vertex AI? Not the default API version. Vertex AI (and enterprise=True in Python) clients still default to v1beta1. The httpx2 change and the Node 22 requirement apply to every client, though.

Should I move everything to v1 or stay on v1beta? Use v1 where it serves your models and features. Pin v1beta only on clients that need aliases, certain previews, Live or caching. That keeps your dependence on the beta surface small and visible.

Is GOOGLE_GENAI_API_VERSION enough by itself? Yes, if no version is set in code. A value in HttpOptions(api_version=...) or apiVersion overrides it, so search your code for both before relying on the variable.

Which version should I install today? 3.6.1 was the latest Python and JavaScript release on 2026-11-18. The breaking changes all arrived in 3.0.0. Later 3.x releases added features such as the Decisions API (3.2.0) and experimental Live Interactions (3.5.0).

Do file uploads follow the pinned version? Yes. A 3.0.0 bug fix makes Gemini API file uploads respect the configured or default API version, so uploads and generation calls now use the same version.

References

Written on November 22, 2026, from the release notes above. If you are moving to a new Gemini model at the same time, upgrade the SDK and pin the version first. Then change the model in a separate step, so each error has one cause.

Leave a Comment