Skip to content

feat(providers): add built-in Google Gemini provider profile#105

Merged
tjb-tech merged 1 commit intoHKUDS:mainfrom
glitch-ux:feat/gemini-builtin-provider
Apr 11, 2026
Merged

feat(providers): add built-in Google Gemini provider profile#105
tjb-tech merged 1 commit intoHKUDS:mainfrom
glitch-ux:feat/gemini-builtin-provider

Conversation

@glitch-ux
Copy link
Copy Markdown
Contributor

@glitch-ux glitch-ux commented Apr 11, 2026

Summary

Addresses #90 — adds Google Gemini as a first-class provider in oh setup.

The ProviderSpec for Gemini already exists in api/registry.py and the model picker in backend_host.py already suggests gemini-2.5-pro / gemini-2.5-flash. However, there is no built-in provider profile, so oh setup never 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 to default_provider_profiles() (api_format=openai, auth_source=gemini_api_key, default_model=gemini-2.5-flash, base_url from AI Studio OpenAI-compat endpoint); register gemini_api_key in auth_source_provider_name() and default_auth_source_for_provider()
  • auth/manager.py — add "gemini" to _KNOWN_PROVIDERS, "gemini_api_key" to _AUTH_SOURCES, and "gemini": "gemini" to _PROFILE_BY_PROVIDER
  • cli.py — add "gemini": "Google Gemini" to _PROVIDER_LABELS and _AUTH_SOURCE_LABELS; include "gemini" in the oh auth login API-key flow condition
  • README.md / README.zh-CN.md — add Gemini row to the OpenAI-Compatible provider table
  • CHANGELOG.md — add entry under [Unreleased] > Added

After this PR

oh setup gemini          # guided setup: enter Gemini API key from AI Studio
oh auth login gemini     # or set the key directly
oh -p "Hello"            # uses gemini-2.5-flash by default

Users can obtain a free API key from Google AI Studio.

Test plan

  • ruff check src tests scripts passes
  • Full test suite passes (573 passed, 6 skipped, 1 xfailed — no regressions)
  • Verify oh setup lists "Google Gemini" as a provider choice
  • Verify oh auth login gemini prompts for the API key and stores it
  • Verify oh -p "Hello" works with a valid Gemini API key

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
@tjb-tech tjb-tech merged commit b9965a1 into HKUDS:main Apr 11, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants