Add LiteLLM default API base for model configs

This commit is contained in:
alfonso gonzalez 2026-03-02 10:32:18 -08:00
parent 69f581f54b
commit b84bf02a7e
No known key found for this signature in database
2 changed files with 8 additions and 0 deletions

View file

@ -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":

View file

@ -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",