MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / lookupAPIKeyUpstreamModel

Method lookupAPIKeyUpstreamModel

sdk/cliproxy/auth/conductor.go:972–1001  ·  view source on GitHub ↗
(authID, requestedModel string)

Source from the content-addressed store, hash-verified

970}
971
972func (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
1003func isAPIKeyAuth(auth *Auth) bool {
1004 if auth == nil {

Calls 3

ParseSuffixFunction · 0.92
LoadMethod · 0.65