Skip to content

feat(inference): add Google Gemini BYOK support - #439

Open
DevLucyy wants to merge 5 commits into
Conway-Research:mainfrom
DevLucyy:feat/gemini-byok
Open

DevLucyy wants to merge 5 commits into
Conway-Research:mainfrom
DevLucyy:feat/gemini-byok

Conversation

@DevLucyy

Copy link
Copy Markdown

Description

Adds native Google Gemini Bring-Your-Own-Key (BYOK) support alongside existing OpenAI and Anthropic integrations.

Key Changes

  1. Inference Client:
    • Routes Gemini models directly to the Google OpenAI-compatible endpoint (/v1beta/openai/chat/completions).
    • Supports geminiApiKey configured via AutomatonConfig or GEMINI_API_KEY environment variable.
  2. Model Registry & Router:
    • Synthesizes dynamic model registry entries for Gemini models with survival tier mapping.
    • Adds baseline model discovery for gemini-3.8-flash, gemini-3.8-pro, gemini-2.5-flash, and gemini-1.5-*.
  3. Interactive Setup:
    • Integrates Gemini API key prompts and model choices into the setup wizard (--setup), config editor (--configure), and model picker (--pick-model).
  4. Local / BYOK Credit Protection:
    • Prevents artificial Dead survival tier trigger when operating purely on external BYOK keys without Conway API credits.
  5. Testing & Docs:
    • Added src/__tests__/gemini-byok.test.ts covering router selection, mock routing, and database seeding.
    • Updated DOCUMENTATION.md and CLI shims.

@NosytLabs

Copy link
Copy Markdown

Merged into main as a merge commit after verifying the full suite locally.

Verification: vitest run on the merged tree under the CI Node version (22) — 73 files, 1757 tests, 0 failures.

Dependency conflicts were resolved in favour of main: this branch predates the dependency refresh (better-sqlite3 13, vitest 5, pnpm-only lockfile), so its package.json/pnpm-lock.yaml changes and its npm package-lock.json were dropped and only the source and test changes landed. For #439 the Gemini support was ported onto main's current inference client (local-mode routing, resilient HTTP timeouts and the dispatcher are main's; the Gemini backend, endpoint and key wiring are the PR's).

@NosytLabs NosytLabs mentioned this pull request Nov 3, 2026
@NosytLabs

Copy link
Copy Markdown

Merged into main as a merge commit (e38bc2d) after verifying the full suite locally: vitest run on the merged tree under the CI Node version — 73 files, 1757 tests, 0 failures.

The token available here cannot close or merge PRs through the API (does not have the correct permissions to execute MergePullRequest), so this PR will still read as open until someone closes it from the GitHub UI. The code is on main.

Dependency conflict resolution: this branch predates main's dependency refresh (better-sqlite3 13, vitest 5, pnpm-only lockfile), so its package.json/pnpm-lock.yaml changes and its npm package-lock.json were dropped. The Gemini support was ported onto main's current inference client — main keeps its local-mode routing (forceLocalBackend), its resilient HTTP timeouts and the undici dispatcher; the PR contributes the Gemini backend, its OpenAI-compatible endpoint, the key wiring in resolveInferenceBackend and the registry registration in index.ts.

@NosytLabs

Copy link
Copy Markdown

Correction to the merge note above, for accuracy: the merge landed in NosytLabs/automation (the private mirror this worktree is wired to, where the token has write access), not in this public upstream repo.

NosytLabs/automation main now contains the branch commits: 2289982 (#431), 994fd50 (#433), e38bc2d (#439) — verified green there with pnpm build, pnpm typecheck and vitest run (73 files, 1757 tests, 0 failures).

Upstream Conway-Research/automaton main is still at d8f81688, and the token available here has push: false on this repo, so it cannot merge or close these PRs here — that needs a maintainer with write access. If upstream is where these should land, the three commits can be pushed as-is or cherry-picked, since the dependency conflicts were already resolved in favour of the refreshed dependency set.

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