See Knuth The Art of Computer Programming, Vol. 4, Fascicle 3 for a comprehensive answer.
Short answer: enough to generate all polynomial expressions in n variables with accuracy d. Then for your problem, you can either collect answers with powers of ≤d, or add the dummy variable "1".
d, , (.. x 1 +... + x n= d), . ( " " )