diff --git a/sdk/cliproxy/auth/manager.go b/sdk/cliproxy/auth/manager.go index dc7887e7..9f247bb9 100644 --- a/sdk/cliproxy/auth/manager.go +++ b/sdk/cliproxy/auth/manager.go @@ -375,10 +375,19 @@ func (m *Manager) executeWithProvider(ctx context.Context, provider string, req } accountType, accountInfo := auth.AccountInfo() + proxyInfo := auth.ProxyInfo() if accountType == "api_key" { - log.Debugf("Use API key %s for model %s", util.HideAPIKey(accountInfo), req.Model) + if proxyInfo != "" { + log.Debugf("Use API key %s for model %s %s", util.HideAPIKey(accountInfo), req.Model, proxyInfo) + } else { + log.Debugf("Use API key %s for model %s", util.HideAPIKey(accountInfo), req.Model) + } } else if accountType == "oauth" { - log.Debugf("Use OAuth %s for model %s", accountInfo, req.Model) + if proxyInfo != "" { + log.Debugf("Use OAuth %s for model %s %s", accountInfo, req.Model, proxyInfo) + } else { + log.Debugf("Use OAuth %s for model %s", accountInfo, req.Model) + } } tried[auth.ID] = struct{}{} @@ -423,10 +432,19 @@ func (m *Manager) executeCountWithProvider(ctx context.Context, provider string, } accountType, accountInfo := auth.AccountInfo() + proxyInfo := auth.ProxyInfo() if accountType == "api_key" { - log.Debugf("Use API key %s for model %s", util.HideAPIKey(accountInfo), req.Model) + if proxyInfo != "" { + log.Debugf("Use API key %s for model %s %s", util.HideAPIKey(accountInfo), req.Model, proxyInfo) + } else { + log.Debugf("Use API key %s for model %s", util.HideAPIKey(accountInfo), req.Model) + } } else if accountType == "oauth" { - log.Debugf("Use OAuth %s for model %s", accountInfo, req.Model) + if proxyInfo != "" { + log.Debugf("Use OAuth %s for model %s %s", accountInfo, req.Model, proxyInfo) + } else { + log.Debugf("Use OAuth %s for model %s", accountInfo, req.Model) + } } tried[auth.ID] = struct{}{} @@ -471,10 +489,19 @@ func (m *Manager) executeStreamWithProvider(ctx context.Context, provider string } accountType, accountInfo := auth.AccountInfo() + proxyInfo := auth.ProxyInfo() if accountType == "api_key" { - log.Debugf("Use API key %s for model %s", util.HideAPIKey(accountInfo), req.Model) + if proxyInfo != "" { + log.Debugf("Use API key %s for model %s %s", util.HideAPIKey(accountInfo), req.Model, proxyInfo) + } else { + log.Debugf("Use API key %s for model %s", util.HideAPIKey(accountInfo), req.Model) + } } else if accountType == "oauth" { - log.Debugf("Use OAuth %s for model %s", accountInfo, req.Model) + if proxyInfo != "" { + log.Debugf("Use OAuth %s for model %s %s", accountInfo, req.Model, proxyInfo) + } else { + log.Debugf("Use OAuth %s for model %s", accountInfo, req.Model) + } } tried[auth.ID] = struct{}{} diff --git a/sdk/cliproxy/auth/types.go b/sdk/cliproxy/auth/types.go index 25e88b96..efba6981 100644 --- a/sdk/cliproxy/auth/types.go +++ b/sdk/cliproxy/auth/types.go @@ -157,6 +157,20 @@ func (m *ModelState) Clone() *ModelState { return ©State } +func (a *Auth) ProxyInfo() string { + if a == nil { + return "" + } + proxyStr := strings.TrimSpace(a.ProxyURL) + if proxyStr == "" { + return "" + } + if idx := strings.Index(proxyStr, "://"); idx > 0 { + return "via " + proxyStr[:idx] + " proxy" + } + return "via proxy" +} + func (a *Auth) AccountInfo() (string, string) { if a == nil { return "", ""