The requested generalization of Jacobi's two-square theorem is a remarkably recent result: N. Bagis and M.L Glasser, On the Number of Representations of Integers by various Quadratic and Higher Forms (2015):
http://ilorentz.org/beenakker/MO/sumofsquares_2.pngwhere $r(n)$ is Jacobi's formula for the number of representations of $n=x^2+y^2$.
I understand from the comments that this formula is not what the OP was looking for. Specific cases are considered by Berkovich and Yesilyurt in Ramanujan's Identities and Representation of Integers by Certain Binary and Quaternary Quadratic Forms (2006). One representative example is given below, there are several others ($n=k^2+15l^2$, $n=k^2+6l^2$, $k^2+27l^2$,...)
http://ilorentz.org/beenakker/MO/arXiv_0611300.png