Skip to content

feat: add native Google Gemini provider and new registry entries#10

Merged
pacifio merged 1 commit intopacifio:mainfrom
renezander030:feat/3-add-providers
Apr 9, 2026
Merged

feat: add native Google Gemini provider and new registry entries#10
pacifio merged 1 commit intopacifio:mainfrom
renezander030:feat/3-add-providers

Conversation

@renezander030
Copy link
Copy Markdown
Contributor

Summary

  • Add a native Google Gemini provider (gemini.rs) using Google's generateContent API instead of routing through the OpenAI-compatible shim. Supports streaming, tool calling via functionCall/functionResponse, systemInstruction, safety settings, and usage token tracking.
  • Introduce ApiFormat::Google variant in the registry and router so the Gemini provider is selected automatically when using google/gemini-* model strings.
  • Add Cohere and SambaNova as new OpenAI-compatible registry entries with auto-detect for command-r* model prefixes.

Details

The existing setup routed Google Gemini through their OpenAI-compat endpoint (/v1beta/openai), which works but limits access to native Gemini features. The new provider talks directly to the generateContent streaming API, following the same Provider trait pattern as Anthropic and OpenAi.

Provider count goes from 13 to 15 (Cohere, SambaNova). All existing tests pass plus 3 new tests for the added providers.

Test plan

  • cargo check passes with no new warnings
  • cargo test -p cersei-provider -- all 9 tests pass (6 existing + 3 new)
  • Manual: from_model_string("google/gemini-2.0-flash") returns a Gemini provider (requires GOOGLE_API_KEY)
  • Manual: from_model_string("cohere/command-r-plus") returns an OpenAI-compat provider (requires COHERE_API_KEY)
  • Manual: from_model_string("command-r-plus") auto-detects Cohere

Addresses #3

…y entries

Add a dedicated Gemini provider using Google's native generateContent API
instead of the OpenAI-compatible shim. This enables proper support for
Gemini-specific features like safety settings, native tool calling via
functionCall/functionResponse, and systemInstruction.

Also adds Cohere and SambaNova as OpenAI-compatible registry entries with
auto-detect support for command-r model prefixes.
@pacifio
Copy link
Copy Markdown
Owner

pacifio commented Apr 9, 2026

These seem good, thanks for the contribution @renezander030

@pacifio pacifio merged commit a1702ab into pacifio:main Apr 9, 2026
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