Skip to content

feat(provider): add gemini google-generative-ai compatibility#110

Open
fuhao009 wants to merge 2 commits intosipeed:mainfrom
fuhao009:feat/gemini-provider-compat
Open

feat(provider): add gemini google-generative-ai compatibility#110
fuhao009 wants to merge 2 commits intosipeed:mainfrom
fuhao009:feat/gemini-provider-compat

Conversation

@fuhao009
Copy link

Summary

  • add provider compatibility groundwork for API mode and custom headers
  • add Gemini (google-generative-ai) request/response compatibility
  • support Gemini generateContent endpoint and tool-call mapping

Validation

  • go build -o ./build/picoclaw ./cmd/picoclaw
  • debug run confirms request path: /v1beta/models/{model}:generateContent
  • upstream service may return 503 when account pool unavailable

@Leeaandrob
Copy link
Collaborator

@Zepan Gemini compatibility provider — useful addition. Same note as other provider PRs: PR #213 (Provider Refactor — roadmap #283) will restructure the provider layer.

Recommendation: Wait for #213 to merge. Gemini could be registered as an OpenAI-compatible provider in the new architecture, making integration simpler.

@yinwm
Copy link
Collaborator

yinwm commented Feb 20, 2026

Thanks for this contribution! The Gemini native API support is valuable.

However, this PR needs significant rework due to recent architecture changes:

  1. Provider Architecture Refactored (feat(config): refactor provider architecture to protocol-based model_list #492)

PR #492 (merged 2026-02-20) introduced a protocol-based model_list configuration. See the design doc:
provider-refactoring.md

  1. Current State

The existing gemini protocol uses OpenAI-compatible /chat/completions endpoint:
case "gemini":
return NewHTTPProviderWithMaxTokensField(...) // OpenAI compat

  1. Suggested Approach

To add native Gemini API support, please:

  1. Create a new protocol prefix (e.g., gemini-native or google-generative-ai)
  2. Create pkg/providers/gemini/provider.go following the pattern of anthropic/ or openai_compat/
  3. Register the new protocol in pkg/providers/factory_provider.go

Example configuration:

  {
    "model_list": [
      {
        "model_name": "my-gemini",
        "model": "gemini-native/gemini-2.0-flash",
        "api_key": "xxx"
      }
    ]
  }

@fuhao009

@xiaket
Copy link
Collaborator

xiaket commented Feb 25, 2026

@fuhao009 gentle nudge :)

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.

4 participants