We propose a general, fully gate-based quantum algorithm for counterdiabatic driving. The algorithm does not depend on heuristics as in previous variational methods and exploits regularization of the adiabatic gauge potential to suppress only the transitions from the eigenstate of interest. This allows for a rigorous quantum gate complexity upper bound in terms of the minimum gap Δ around this eigenstate. We find that, in the worst case, the algorithm requires at most Õ{Δ-[3+o(1)]ϵ-[1+o(1)]} quantum gates to achieve a target state fidelity of at least 1-ϵ2, where Δ is the minimum spectral gap. In certain cases, the gap dependence can be improved to quadratic.