Protected_Protected_Protected ReadonlydiscoveryProtected ReadonlylanguageProtected ReadonlyloggerProtected ReadonlymodelCached /v1beta/models lookups keyed by model id. Successful lookups are kept for the process lifetime;
failed lookups are evicted so the next call retries.
ProtectedretryProtectedcalculateProtectedcreateProtectedderiveAPI thinking=false disables reasoning even when the model id suggests support.
Fetches the ids of the Gemini models that currently support content generation from the
/v1beta/models endpoint, retrying transient failures and caching a snapshot for offline use.
Returns an empty result when no key is configured; falls back to the cached snapshot on failure.
ProtectedfetchReports where the effective API key comes from (preference, environment, or none).
ProtectedisHeuristic for the Gemini chat models among the entries that are left once toDiscoveredModels
has dropped what cannot generate content at all. Two things remain to be excluded, and both
report generateContent like a chat model: a model that generates something other than text
(an image, speech), and one that answers through an agentic API of its own (deep research,
computer use, robotics). Everything outside the gemini-* family goes too — Gemma, LearnLM —
since being able to generate content does not make a model one of the models this provider is
about. Anything this misses can be configured as a custom endpoint.
The Live API models need no term of their own: they report bidiGenerateContent, so the
capability check has already left them out.
Without a release date to go by, the ranking that decides which models the chat input offers
falls back to the numbers in the id, and those only mean a version within this family: a
parameter count (gemma-3-27b-it) or an experiment date would otherwise read as the newest
model there is.
ProtectedisRetry transient network errors; auth/quota errors fail fast. The SDK reports them as plain errors, so there is nothing to match on but the message.
ProtectedlistIterates the (auto-paginated) /v1beta/models endpoint. Overridable for testing.
ProtectedresolveDescription overrides win over the values derived from /v1beta/models.
ProtectedretrieveAllows or refuses the use of an API key found in the environment. Refused by default: an
environment key is only used once the user has confirmed it, and setting this back to false
stops it being used immediately, wherever it would have been used.
ProtectedtoMaps the endpoint's entries onto DiscoveredModels. Gemini ids carry no release date today, so collapsing dated variants is a no-op here; it is applied all the same, so a provider that starts pinning releases does not quietly multiply the list.
Whether a key found in the environment may be used. Withheld until the user confirms it, so the gate sits on the key itself: every path that reaches for one — discovery, a custom endpoint, a manually configured model — is covered, and revoking the consent takes effect at once.