Skip to content

Add Google Gemini 2.5 Pro provider to the Inference effect #451

@aallan

Description

@aallan

Add Google Gemini 2.5 Pro as a provider for the Inference effect. Unlike the OpenAI-compatible providers (Mistral, xAI, DeepSeek), Gemini uses a distinct API shape that requires custom request/response handling — similar to how Anthropic is handled today.

API details

  • Base URL: https://generativelanguage.googleapis.com/v1beta/models/{model}:generateContent (model embedded in URL)
  • Auth: query param ?key={API_KEY} or header x-goog-api-key: {key}
  • Default model: gemini-2.5-pro
  • Request body: uses contents array with {"role": "user", "parts": [{"text": prompt}]} instead of messages
  • Response path: data["candidates"][0]["content"]["parts"][0]["text"]
  • Env var: VERA_GEMINI_API_KEY

Implementation notes
The request body format and response path differ from both the OpenAI-compatible providers and Anthropic, so this cannot reuse the shared OpenAI dispatch path. After #413 lands with the _ProviderConfig registry, Gemini will need either:

  1. Custom fields in _ProviderConfig for request_format and response_path, or
  2. A small _gemini_call helper alongside _anthropic_call (Anthropic's current pattern)

Option 2 is simpler and consistent with the existing Anthropic special-case. The _PROVIDERS registry can dispatch to a callable instead of a config when custom logic is required.

Depends on #413.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestintegrationIntegration with external tools and languages

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions