From b84bf02a7ef0edad342c16d5d6503a81b2fcd452 Mon Sep 17 00:00:00 2001 From: alfonso gonzalez Date: Mon, 2 Mar 2026 10:32:18 -0800 Subject: [PATCH] Add LiteLLM default API base for model configs --- pkg/providers/factory_provider.go | 2 ++ pkg/providers/factory_provider_test.go | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/pkg/providers/factory_provider.go b/pkg/providers/factory_provider.go index dc538e646..155317a3b 100644 --- a/pkg/providers/factory_provider.go +++ b/pkg/providers/factory_provider.go @@ -180,6 +180,8 @@ func getDefaultAPIBase(protocol string) string { return "https://api.openai.com/v1" case "openrouter": return "https://openrouter.ai/api/v1" + case "litellm": + return "http://localhost:4000/v1" case "groq": return "https://api.groq.com/openai/v1" case "zhipu": diff --git a/pkg/providers/factory_provider_test.go b/pkg/providers/factory_provider_test.go index 00779b4d0..78389f331 100644 --- a/pkg/providers/factory_provider_test.go +++ b/pkg/providers/factory_provider_test.go @@ -135,6 +135,12 @@ func TestCreateProviderFromConfig_DefaultAPIBase(t *testing.T) { } } +func TestGetDefaultAPIBase_LiteLLM(t *testing.T) { + if got := getDefaultAPIBase("litellm"); got != "http://localhost:4000/v1" { + t.Fatalf("getDefaultAPIBase(%q) = %q, want %q", "litellm", got, "http://localhost:4000/v1") + } +} + func TestCreateProviderFromConfig_LiteLLM(t *testing.T) { cfg := &config.ModelConfig{ ModelName: "test-litellm",