Skip to content

Comments

Add Gemini Provider Support with Custom Base URL Configuration#188

Open
ericproulx wants to merge 1 commit intomainfrom
feature/add_gemini_provider
Open

Add Gemini Provider Support with Custom Base URL Configuration#188
ericproulx wants to merge 1 commit intomainfrom
feature/add_gemini_provider

Conversation

@ericproulx
Copy link
Collaborator

Summary

This PR adds support for configuring custom base URLs for the Gemini provider in SwarmSDK, enabling agents to use Google's Gemini API through custom endpoints or proxies.

Changes

  • LLM Configuration: Extended lib/swarm_sdk/agent/chat_helpers/llm_configuration.rb to handle Gemini provider when a custom base_url is specified

    • Configures gemini_api_base from the provided base URL
    • Retrieves and sets gemini_api_key from SwarmSDK configuration
  • Test Coverage: Added test_initialization_with_base_url_and_gemini_provider in test/swarm_sdk/agent/chat_test.rb

    • Verifies that Agent::Chat can be initialized with Gemini provider and custom base URL
    • Ensures proper handling of Gemini API key from environment variables

Technical Details

The implementation follows the same pattern as other providers (OpenAI, Anthropic, Ollama, GPUStack) by:

  1. Checking if the provider is "gemini" in the base_url configuration block
  2. Setting the gemini_api_base configuration option
  3. Retrieving and setting the API key from SwarmSDK configuration

Test Plan

  • Added unit test for Gemini provider with custom base_url
  • Test verifies successful Agent::Chat initialization
  • Test properly manages API key environment variable
  • Manual testing with actual Gemini API endpoint (recommended before merge)

Impact

  • Low risk: Adds new functionality without modifying existing provider behavior
  • Enables users to configure Gemini models with custom endpoints
  • Maintains consistency with existing provider configuration patterns

…tion

Add support for configuring custom base URLs for the Gemini provider,
enabling SwarmSDK to work with Gemini API through custom endpoints.
@ericproulx ericproulx requested a review from parruda January 30, 2026 12:29
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.

1 participant