Repository navigation
Add Google Gemini as an API provider (via Anthropic-compatible gateway) - #329
Open
zwanski-start wants to merge 1 commit into
Open
zwanski-start wants to merge 1 commit into
zwanski-start wants to merge 1 commit into
Conversation
…AutoForgeAI#94) Adds a 'gemini' preset to API_PROVIDERS that points the Claude Agent SDK at an Anthropic-compatible gateway (LiteLLM, default localhost:4000) which translates requests to the Gemini API. The settings UI exposes an editable base URL and custom model name for it. Documents setup in README, CLAUDE.md and .env.example, and adds provider env tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
🔍 QA report: ✅ PassedTester: Barbara (cubefarm agent, in a fresh session) · Round: 1 · Author: Ken Adds a 'gemini' provider entry (LiteLLM gateway at http://localhost:4000, gemini-2.5-pro/flash) to the existing provider setup, plus Settings UI fields, docs and tests. On a live server with no API key, selecting Gemini saves the right settings and the agent would receive the gateway URL and Gemini model with Claude/Vertex credentials blanked. Custom base URL and model overrides saved from the UI, and the page shows no console errors. Lint, build and the new tests pass, and the remaining pytest and mypy failures also occur on master.
🧪 Commands run
No browser screenshots were taken in this round. Posted by cubefarm · merges automatically once GitHub's checks pass |
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.
Closes #94
What changed
AutoForge's agents run on the Claude Agent SDK / Claude CLI, which speaks the Anthropic Messages API. Google doesn't offer an Anthropic-compatible endpoint for Gemini, so this PR adds Gemini through the existing API provider abstraction (
API_PROVIDERSinregistry.py→get_effective_sdk_env()). It targets an Anthropic-compatible gateway (LiteLLM) that translates/v1/messagescalls to the Gemini API. GLM, Kimi, Ollama and Azure already plug in the same way.registry.py: adds a newgeminiprovider called "Google Gemini (via LiteLLM)"http://localhost:4000(LiteLLM's default port)ANTHROPIC_AUTH_TOKEN(the gateway master key, if one is set)gemini-2.5-pro(default) andgemini-2.5-flashANTHROPIC_API_KEYand Vertex vars, so Claude credentials don't leak to the gateway.SettingsModal.tsx,views/SettingsView.tsx): Gemini shows an editable base URL with ahttp://localhost:4000placeholder, a custom model name input, and a hint explaining the gateway and API key.README.md,CLAUDE.mdand.env.example(one-linelitellm --model gemini/gemini-2.5-pro --alias gemini-2.5-pro --port 4000).test_api_providers.py(new tests):Verification
ruff check .passespytest test_api_providers.py test_client.py: 30 passedpython test_security.py: all tests passnpm run lint: 0 errors (6 warnings that were already there)npm run buildsucceedsHOME, so real settings weren't touched:/api/settings/providerslistsgeminihttp://localhost:4000, the two Gemini models and the custom model inputapi_provider=gemini,api_model=gemini-2.5-proNot tested: a real agent session against Gemini (no Gemini key or LiteLLM gateway in this environment).
Assumptions / notes
model_listalias) can be typed into the custom model input.AutoForgeAI/autoforge(403, read-only access), so this PR comes from thezwanski-startfork.🤖 Generated with Claude Code