| 970 | } |
| 971 | |
| 972 | func (m *Manager) lookupAPIKeyUpstreamModel(authID, requestedModel string) string { |
| 973 | if m == nil { |
| 974 | return "" |
| 975 | } |
| 976 | authID = strings.TrimSpace(authID) |
| 977 | if authID == "" { |
| 978 | return "" |
| 979 | } |
| 980 | requestedModel = strings.TrimSpace(requestedModel) |
| 981 | if requestedModel == "" { |
| 982 | return "" |
| 983 | } |
| 984 | table, _ := m.apiKeyModelAlias.Load().(apiKeyModelAliasTable) |
| 985 | if table == nil { |
| 986 | return "" |
| 987 | } |
| 988 | byAlias := table[authID] |
| 989 | if len(byAlias) == 0 { |
| 990 | return "" |
| 991 | } |
| 992 | key := strings.ToLower(thinking.ParseSuffix(requestedModel).ModelName) |
| 993 | if key == "" { |
| 994 | key = strings.ToLower(requestedModel) |
| 995 | } |
| 996 | resolved := strings.TrimSpace(byAlias[key]) |
| 997 | if resolved == "" { |
| 998 | return "" |
| 999 | } |
| 1000 | return preserveRequestedModelSuffix(requestedModel, resolved) |
| 1001 | } |
| 1002 | |
| 1003 | func isAPIKeyAuth(auth *Auth) bool { |
| 1004 | if auth == nil { |