Skip to content

Add api_version field to Gemini to support stable Vertex AI v1 API - #6711

Open
guptaishaan wants to merge 1 commit into
google:mainfrom
guptaishaan:fix/issue-3246-2026
Open

Add api_version field to Gemini to support stable Vertex AI v1 API#6711
guptaishaan wants to merge 1 commit into
google:mainfrom
guptaishaan:fix/issue-3246-2026

Conversation

@guptaishaan

Copy link
Copy Markdown
Contributor

ADK currently hard-codes v1beta1 as the Vertex AI API version for all Gemini
requests, including both generate_content and live-connect paths. This means
production workloads running on GA models (e.g. Gemini 2.5 Pro) are still
hitting a beta endpoint, which is outside the Vertex AI Gemini SLA.

This PR adds an api_version field to the Gemini model class. When set it
overrides both the version inferred from a base_url suffix and the
per-backend defaults (v1beta1 for Vertex AI, v1alpha for Gemini API). The
field flows automatically into api_client, _live_api_client, and every
generate_content / connect call via the existing _base_url_and_api_version
/ _live_api_version machinery.

Users can opt into the stable endpoint with:

from google.adk.models import Gemini
agent = Agent(model=Gemini(model="gemini-2.5-pro", api_version="v1"))

Three regression tests are added to test_google_llm.py covering the override
at the live-version, base-url-conflict, and api-client levels.

Fixes #3246

ADK currently hard-codes `v1beta1` as the Vertex AI API version for all Gemini

Signed-off-by: Ishaan <ishaangupta0408@gmail.com>
@adk-bot adk-bot added the core [Component] This issue is related to the core interface and implementation label Aug 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core [Component] This issue is related to the core interface and implementation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for stable Vertex AI v1 API

3 participants