You can run the air purifier at all times if you need to. This is usually the case in urban areas with dense population and traffic. The good air from the purifier would last for about three to four hours. Then the air would have pollutants once again. So you’d be better off having it on at all times.
On the other hand, if you’re concerned about excessive energy use and the filter needing replacement earlier, you can use it in intervals. You can also set a timer if the model you have allows that. When leaving your home for several hours, you can shut it down to save energy.
If you smoke constantly, then you should have it running all the time. Alternatively, you can purchase an energy-efficient air purifier that does not consume a lot of energy and saves money.