Earning income on retirement visa

Looking to get a Portuguese residency visa for retirement. I generally have enough passive income. But after I pack it in, I am looking at doing some consulting work for some of my clients in the states just to stay busy and earn a few pesos. Does anyone know if this is precluded under a visa for retirement?

Portugal D7 visa does allow one to work.

Only if it’s not for Portuguese companies

Excellent, thanks for the advice