feat(providers): add built-in Google Gemini provider profile#105
Merged
tjb-tech merged 1 commit intoHKUDS:mainfrom Apr 11, 2026
Merged
feat(providers): add built-in Google Gemini provider profile#105tjb-tech merged 1 commit intoHKUDS:mainfrom
tjb-tech merged 1 commit intoHKUDS:mainfrom
Conversation
Wire Gemini as a first-class provider so `oh setup` offers it alongside Anthropic, OpenAI, Moonshot, and others. The ProviderSpec for Gemini already existed in the API registry; this commit adds the missing profile, auth-source mappings, and CLI integration so users can configure Gemini through the standard setup flow instead of manually creating a custom profile. Changes: - Add "gemini" entry to `default_provider_profiles()` with `gemini-2.5-flash` as default model and the AI Studio OpenAI-compat base URL - Register `gemini_api_key` auth source in `auth_source_provider_name()` and `default_auth_source_for_provider()` - Add gemini to `_KNOWN_PROVIDERS`, `_AUTH_SOURCES`, and `_PROFILE_BY_PROVIDER` in `auth/manager.py` - Add gemini to `_PROVIDER_LABELS`, `_AUTH_SOURCE_LABELS`, and the `oh auth login` API-key flow in `cli.py` - Add Gemini row to the OpenAI-Compatible provider table in both README.md and README.zh-CN.md Closes HKUDS#90
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.
Summary
Addresses #90 — adds Google Gemini as a first-class provider in
oh setup.The
ProviderSpecfor Gemini already exists inapi/registry.pyand the model picker inbackend_host.pyalready suggestsgemini-2.5-pro/gemini-2.5-flash. However, there is no built-in provider profile, sooh setupnever offers Gemini and users must manually create a custom profile. This PR closes that gap by wiring the profile, auth-source mappings, and CLI login flow.Changes
config/settings.py— add"gemini"entry todefault_provider_profiles()(api_format=openai, auth_source=gemini_api_key, default_model=gemini-2.5-flash, base_url from AI Studio OpenAI-compat endpoint); registergemini_api_keyinauth_source_provider_name()anddefault_auth_source_for_provider()auth/manager.py— add"gemini"to_KNOWN_PROVIDERS,"gemini_api_key"to_AUTH_SOURCES, and"gemini": "gemini"to_PROFILE_BY_PROVIDERcli.py— add"gemini": "Google Gemini"to_PROVIDER_LABELSand_AUTH_SOURCE_LABELS; include"gemini"in theoh auth loginAPI-key flow conditionREADME.md/README.zh-CN.md— add Gemini row to the OpenAI-Compatible provider tableCHANGELOG.md— add entry under[Unreleased] > AddedAfter this PR
Users can obtain a free API key from Google AI Studio.
Test plan
ruff check src tests scriptspassesoh setuplists "Google Gemini" as a provider choiceoh auth login geminiprompts for the API key and stores itoh -p "Hello"works with a valid Gemini API key