For any log Fano pair with a torus action, we associate a computable invariant to it, such that the pair is (weighted) K-polystable if and only if this invariant is greater than one. As an application, we present examples of Fano varieties admitting g-solitons for any weight function g.