fix(providers): complete native Gemini ListModels discovery - #116509
Open
LordMelkor wants to merge 3 commits into
Open
LordMelkor wants to merge 3 commits into
LordMelkor wants to merge 3 commits into
Conversation
The native Gemini /v1beta endpoint rejects Bearer auth with HTTP 401, so
ProviderProfile.fetch_models()'s OpenAI-style Authorization header returned
None and the /model picker silently fell back to the 4 static fallback
models instead of the 50+ the account can actually call.
Override fetch_models() in GeminiProfile to hit {base_url}/models?key=<key>
(the same query-param auth the native inference client already uses) and
strip the 'models/' prefix each returned name carries, so live discovery
matches inference.
Fixes NousResearch#62259
Co-authored-by: Codex <noreply@openai.com>
Ai-assisted: true
…act errors Address review: delegate the OpenAI-compat /openai base URL to ProviderProfile.fetch_models (it speaks Bearer + data[].id) instead of forcing native query-param auth, and stop logging the caught exception value — urllib errors embed the request URL, which carries the api_key in the ?key= query param. Log the exception type only. Add regression tests for the compat-branch delegation and the no-key-leak failure path. Co-authored-by: Codex <noreply@openai.com> Ai-assisted: true
Traverse the complete native catalog, authenticate without Bearer, and keep only conversational generateContent models. Fail discovery if pagination repeats a token instead of returning a partial result. Ai-assisted: true Co-authored-by: Codex <noreply@openai.com>
teknium1
added a commit
that referenced
this pull request
Sep 24, 2026
…ng static xfails #120319, #120374 and #120299 are on main, so their probes and every Gap naming them go (the module's own rule); those cells are plain tests now. The two static strict xfails with an open fix PR (#95375 cli resize_scrollback, fix #120321; #62259 Gemini listing, fix #62267/#116509) turned main red the moment the fix merged (XPASS). They now go through _pending_fixes.known_failure: a run-time xfail only while the cell fails with that gap's own message (a turn rendered more than once; an empty live listing), any other failure stays red, and the fix just makes it pass.
teknium1
added a commit
that referenced
this pull request
Sep 24, 2026
…ng static xfails #120319, #120374 and #120299 are on main, so their probes and every Gap naming them go (the module's own rule); those cells are plain tests now. The two static strict xfails with an open fix PR (#95375 cli resize_scrollback, fix #120321; #62259 Gemini listing, fix #62267/#116509) turned main red the moment the fix merged (XPASS). They now go through _pending_fixes.known_failure: a run-time xfail only while the cell fails with that gap's own message (a turn rendered more than once; an empty live listing), any other failure stays red, and the fix just makes it pass.
teknium1
added a commit
that referenced
this pull request
Sep 24, 2026
…ng static xfails #120319, #120374 and #120299 are on main, so their probes and every Gap naming them go (the module's own rule); those cells are plain tests now. The two static strict xfails with an open fix PR (#95375 cli resize_scrollback, fix #120321; #62259 Gemini listing, fix #62267/#116509) turned main red the moment the fix merged (XPASS). They now go through _pending_fixes.known_failure: a run-time xfail only while the cell fails with that gap's own message (a turn rendered more than once; an empty live listing), any other failure stays red, and the fix just makes it pass.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Gemini live discovery now traverses the complete native
ListModelscatalog and keeps only models the chat picker can use. Native requests authenticate withx-goog-api-key, follow continuation tokens, requiregenerateContent, and remove embedding, TTS, live, image, music, video, transcription, and other non-conversational families. A repeated continuation token fails discovery instead of returning a partial catalog.Non-native endpoints retain the existing
ProviderProfile.fetch_models()Bearer anddata[].idcontract, including the Google OpenAI-compatible endpoint and custom relays.This carries forward the two commits from @PRATHAMESH75 in #62267 and adds the missing capability filtering and complete pagination behavior. It is intended to supersede #62267 rather than compete with it.
Related Issue
Fixes #62259
Supersedes #62267.
Type of Change
Changes Made
plugins/model-providers/gemini/__init__.py— add nativeListModelsdiscovery with header authentication, complete pagination, capability filtering, and non-native endpoint delegation.tests/providers/test_fetch_models_base_url.py— exercise native discovery through a local HTTP server, including two-page traversal, filtering, repeated-token failure, missing credentials, and custom relay delegation.How to Test
scripts/run_tests.sh tests/providers/test_fetch_models_base_url.py tests/plugins/model_providers/test_gemini_profile.py.Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests pass — focused suites passed through the repository'sscripts/run_tests.shwrapperDocumentation & Housekeeping
docs/, docstrings) — N/A; the provider docstring describes the behaviorcli-config.yaml.exampleif I added/changed config keys — N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — N/AScreenshots / Logs
Focused validation: 11 passed, 0 failed. The Windows footgun scanner reported no findings in the two changed files.