diff --git a/internal/runtime/executor/usage_helpers.go b/internal/runtime/executor/usage_helpers.go index 1f81c048..e0df5f3e 100644 --- a/internal/runtime/executor/usage_helpers.go +++ b/internal/runtime/executor/usage_helpers.go @@ -129,6 +129,21 @@ func apiKeyFromContext(ctx context.Context) string { func resolveUsageSource(auth *cliproxyauth.Auth, ctxAPIKey string) string { if auth != nil { + provider := strings.TrimSpace(auth.Provider) + if strings.EqualFold(provider, "vertex") { + if auth.Metadata != nil { + if projectID, ok := auth.Metadata["project_id"].(string); ok { + if trimmed := strings.TrimSpace(projectID); trimmed != "" { + return trimmed + } + } + if project, ok := auth.Metadata["project"].(string); ok { + if trimmed := strings.TrimSpace(project); trimmed != "" { + return trimmed + } + } + } + } if _, value := auth.AccountInfo(); value != "" { return strings.TrimSpace(value) }