Merge PR #1378
This commit is contained in:
commit
1c1c1601da
2 changed files with 7 additions and 0 deletions
|
|
@ -462,6 +462,10 @@ func normalizeModel(model, apiBase string) string {
|
||||||
return model
|
return model
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if strings.HasPrefix(strings.ToLower(model), "openrouter/") {
|
||||||
|
return model
|
||||||
|
}
|
||||||
|
|
||||||
if strings.Contains(strings.ToLower(apiBase), "openrouter.ai") {
|
if strings.Contains(strings.ToLower(apiBase), "openrouter.ai") {
|
||||||
return model
|
return model
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -566,6 +566,9 @@ func TestNormalizeModel_UsesAPIBase(t *testing.T) {
|
||||||
if got := normalizeModel("openrouter/auto", "https://openrouter.ai/api/v1"); got != "openrouter/auto" {
|
if got := normalizeModel("openrouter/auto", "https://openrouter.ai/api/v1"); got != "openrouter/auto" {
|
||||||
t.Fatalf("normalizeModel(openrouter) = %q, want %q", got, "openrouter/auto")
|
t.Fatalf("normalizeModel(openrouter) = %q, want %q", got, "openrouter/auto")
|
||||||
}
|
}
|
||||||
|
if got := normalizeModel("openrouter/free", "https://gateway.example.com/v1"); got != "openrouter/free" {
|
||||||
|
t.Fatalf("normalizeModel(openrouter custom api_base) = %q, want %q", got, "openrouter/free")
|
||||||
|
}
|
||||||
if got := normalizeModel("vivgrid/managed", "https://api.vivgrid.com/v1"); got != "managed" {
|
if got := normalizeModel("vivgrid/managed", "https://api.vivgrid.com/v1"); got != "managed" {
|
||||||
t.Fatalf("normalizeModel(vivgrid) = %q, want %q", got, "managed")
|
t.Fatalf("normalizeModel(vivgrid) = %q, want %q", got, "managed")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue