fix: preserve openrouter model ids with custom api base
This commit is contained in:
parent
4a8a2e9c23
commit
9bdcf18b45
2 changed files with 7 additions and 0 deletions
|
|
@ -433,6 +433,10 @@ func normalizeModel(model, apiBase string) string {
|
|||
return model
|
||||
}
|
||||
|
||||
if strings.HasPrefix(strings.ToLower(model), "openrouter/") {
|
||||
return model
|
||||
}
|
||||
|
||||
if strings.Contains(strings.ToLower(apiBase), "openrouter.ai") {
|
||||
return model
|
||||
}
|
||||
|
|
|
|||
|
|
@ -517,6 +517,9 @@ func TestNormalizeModel_UsesAPIBase(t *testing.T) {
|
|||
if got := normalizeModel("openrouter/auto", "https://openrouter.ai/api/v1"); 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" {
|
||||
t.Fatalf("normalizeModel(vivgrid) = %q, want %q", got, "managed")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue