It is proved that the following classes of finitely generated groups have $\Pi_1^1$-complete first-order theories: all finitely generated groups, the $n$-generated groups, and the strictly $n$-generated groups ($n\,{\geqslant}\,2$). Moreover, all those theories are distinct. Similar techniques show that quasi-finitely axiomatizable groups have a hyperarithmetical word problem, where a finitely generated group is quasi-finitely axiomatizable if it is the only finitely generated group satisfying an appropriate first-order sentence. The Turing degrees of word problems of quasi-finitely axiomatizable groups form a cofinal set in the Turing degrees of hyperarithmetical sets.