Skip to content

Support provider-prefixed Gemini model IDs#5555

Open
kenrogers wants to merge 3 commits intogoogle:mainfrom
kenrogers:codex/provider-prefixed-gemini-models
Open

Support provider-prefixed Gemini model IDs#5555
kenrogers wants to merge 3 commits intogoogle:mainfrom
kenrogers:codex/provider-prefixed-gemini-models

Conversation

@kenrogers
Copy link
Copy Markdown

Summary

  • Extract Gemini model names from LiteLLM-compatible provider-prefixed IDs such as gemini/gemini-2.5-flash, vertex_ai/gemini-2.5-flash, and openrouter/google/gemini-2.5-pro:online
  • Keep malformed Vertex projects/... paths from being treated as valid Gemini IDs
  • Add an OpenRouter-through-LiteLLM sample showing OPENROUTER_API_KEY, api_base, and openrouter/... model usage

Why

ADK's Gemini tool checks already normalize native model IDs and Vertex/Apigee paths, but provider-prefixed LiteLLM model IDs were left as-is. That made Google Search reject routed Gemini IDs even when the underlying model name was Gemini. This updates the shared model-name utility so existing Gemini classification paths work for provider-prefixed IDs without special-casing one provider.

Refs #2709.

Tests

  • uv run --extra test pytest tests/unittests/utils/test_model_name_utils.py tests/unittests/tools/test_google_search_tool.py
  • uv run --extra dev pyink --check --diff --config pyproject.toml src/google/adk/utils/model_name_utils.py tests/unittests/utils/test_model_name_utils.py tests/unittests/tools/test_google_search_tool.py contributing/samples/hello_world_openrouter/agent.py contributing/samples/hello_world_openrouter/__init__.py
  • uv run --extra test python -m py_compile contributing/samples/hello_world_openrouter/agent.py

@google-cla
Copy link
Copy Markdown

google-cla Bot commented Apr 30, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@adk-bot
Copy link
Copy Markdown
Collaborator

adk-bot commented Apr 30, 2026

Response from ADK Triaging Agent

Hello @kenrogers, thank you for creating this PR!

Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). You can find more information at https://cla.developers.google.com/.

Thanks!

@adk-bot adk-bot added the models [Component] Issues related to model support label Apr 30, 2026
@kenrogers kenrogers marked this pull request as ready for review April 30, 2026 16:45
@rohityan rohityan self-assigned this Apr 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

models [Component] Issues related to model support

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants