I have heard six months, but I have also heard over a year. If your puppy is to be an in-town family house pet, castrating him will not only eliminate the procreative urge and attendant inclination to wander off in search of females, it will make him more placid, less likely to bark at strangers, better around children, and will reduce his tendency to offend people by sniffing, mounting or lifting his leg at inappropriate times or places. You'll have a good, perhaps a better city pet, although he won't be a real DOG, in the sense of a fully-found male of the species. You should give your pet every opportunity to develop to his full capacity, grow strong bones, a good heart and a full set of gender-specific physical points and personality.
Most small breeds are full-sized at six or eight months.
Large-boned dogs can take longer to fill out, so we'd delay surgery for a full year on a shepherd, Newfoundland or St. Bernard.