feat(config): allow custom providers of type gemini (#585)
This change extends the provider configuration to allow users to define custom providers with `type: "gemini"`.
This enables connecting to any Gemini-compatible API by specifying its `base_url` and `api_key` within the `providers` section of `crush.json`. It supports complex setups, such as using a local proxy or a model-balancing service.
commit6b161d29e9832fe1abafea231d7947e03d76f574
authorkslamph <15257433+kslamph@users.noreply.github.com>
dateWed 24 Sep 2025, 21:12 (1 year ago)
parent3b6a375
internal/config/load.go+1−1
@@ -270,7 +270,7 @@ func (c *Config) configureProviders(env env.Env, resolver VariableResolver, know
270270 c.Providers.Del(id)
271271 continue
272272 }
273− if providerConfig.Type != catwalk.TypeOpenAI && providerConfig.Type != catwalk.TypeAnthropic {
273+ if providerConfig.Type != catwalk.TypeOpenAI && providerConfig.Type != catwalk.TypeAnthropic && providerConfig.Type != catwalk.TypeGemini {
274274 slog.Warn("Skipping custom provider because the provider type is not supported", "provider", id, "type", providerConfig.Type)
275275 c.Providers.Del(id)
276276 continue
internal/llm/provider/gemini.go+3
@@ -43,6 +43,9 @@ func createGeminiClient(opts providerClientOptions) (*genai.Client, error) {
4343 cc := &genai.ClientConfig{
4444 APIKey: opts.apiKey,
4545 Backend: genai.BackendGeminiAPI,
46+ HTTPOptions: genai.HTTPOptions{
47+ BaseURL: opts.baseURL,
48+ },
4649 }
4750 if config.Get().Options.Debug {
4851 cc.HTTPClient = log.NewHTTPClient()