By the DMG's charts and demographics.......
Your capitol city has 1 million inhabitants, four times what the DMG notes as the minimum for a Metropolis. As a Metropolis, your capitol likely has (ignore any of these that aren't at least moderately close to appropriate for the city's alignment and culture): 4 NPC Warriors of 14th-20th level, 4 NPC Fighters of 13th-20th level, 4 NPC Barbarians of 13th-16th level, 4 NPC Monks of 13th-16th level, 4 NPC Paladins of 13th-15th level, and 4 NPC Rangers of 13th-15th level. These are all the NPC combat-centric folks that could likely be in the city's military or who might be conscripted/asked to serve in the city's defense. In addition, your capitol city probably has 4 NPC Aristocrats of 13th-16th level, 4 NPC Experts of 15th-20th level, 4 NPC Bards of 13th-18th level, and 4 NPC Rogues of 13th-20th level, a few of each might be part of the military or within the ruler's capacity to recruit for the city's defense.
Some of those high-level Aristocrats, Experts, Bards, and Rogues though are almost certainly going to be freelancers, travelers, criminals, vagrants, or retired elderly citizens, with no inclination to fight for the city or just no real strength/health to be of any help. Keep in mind that several of the highest-level NPCs in the community are going to be elderly and in poor shape for fighting, though many will have been very active combatants way back in the day. Also keep in mind that your city may or may not have enough weapons, suits of armor, shields, ammunition, and such to equip all the potential defenders. Most of the commoners and experts probably wouldn't own any real arms and armor.
Your capitol city likely also has, according to the DMG's suggestions, 4 NPC Adepts of 13th-18th level, 4 NPC Commoners of 16th-20th level, 4 NPC Clerics of 13th-18th level, 4 NPC Druids of 13th-18th level, 4 NPC Sorcerers of 13th-16th level, and 4 NPC Wizards of 13th-16th level. Some of these likely wouldn't fight for the city, especially since at least a few of them are going to be criminals, rebels, anarchists, or travelers with no allegiance to the city's ruler, and are likely to just book it once they find out an enemy army is approaching (and being high-level, they're not likely to be stopped from fleeing while you deal with the impending siege). You could probably count on half or more of these, I suppose, to help defend the city at least briefly.
As for lesser NPCs, lessee.......likely your capitol city would have (many of these, aside from the combative types, are unlikely to be very combat-willing nor possess arms/armor):
(class)_______________(level)_____(number of them)
Adept_______________L8_____#8
Adept_______________L4_____#16
Adept_______________L2_____#32
Aristocrat_______________L7_____#8
Aristocrat_______________L3_____#16
Barbarian_______________L7_____#8
Barbarian_______________L3_____#16
Barbarian_______________L1_____#32
Bard_______________L8_____#8
Bard_______________L4_____#16
Bard_______________L2_____#32
Bard_______________L1_____#64
Cleric_______________L8_____#8
Cleric_______________L4_____#16
Cleric_______________L2_____#32
Cleric_______________L1_____#64
Commoner_______________L9_____#8
Commoner_______________L4_____#16
Commoner_______________L2_____#32
Druid_______________L8_____#8
Druid_______________L4_____#16
Druid_______________L2_____#32
Druid_______________L1_____#64
Expert_______________L9_____#8
Expert_______________L4_____#16
Expert_______________L2_____#32
Fighter_______________L9_____#8
Fighter_______________L4_____#16
Fighter_______________L2_____#32
Fighter_______________L1_____#64
Monk_______________L7_____#8
Monk_______________L3_____#16
Monk_______________L17_____#32
Paladin_______________L7_____#8
Paladin_______________L3_____#16
Paladin_______________L1_____#32
Ranger_______________L7_____#8
Ranger_______________L3_____#16
Ranger_______________L1_____#32
Rogue_______________L9_____#8
Rogue_______________L4_____#16
Rogue_______________L2_____#32
Rogue_______________L1_____#64
Sorcerer_______________L7_____#8
Sorcerer_______________L3_____#16
Sorcerer_______________L1_____#32
Warrior_______________L8_____#8
Warrior_______________L4_____#16
Warrior_______________L2_____#32
Wizard_______________L7_____#8
Wizard_______________L3_____#16
Wizard_______________L1_____#32
The DMG doesn't have numbers for psionic classes or whatnot, so just choose the most similar core class to model them on numbers-wise.
Altogether, this accounts for less than 2 thousand inhabitants. Since your city is 4 times the size of what the DMG lists as the minimum population of a Metropolis, I'll quadruple this number. After any psionic residents are accounted for, that makes for about 8 thousand inhabitants. 1,000,000 - 8,000 = 992,000 others. Roughly two-thirds of the population, give or take a bit, will be children and such, so..... 992,000 - 660,000 = 332,000 adults left to account for. By the DMG's numbers, that'd be.... 302,120 commoners of 1st-level, 16,600 warriors of 1st-level, 9,960 experts of 1st-level, 1,660 aristocrats of 1st-level, and 1,660 adepts of 1st-level. Thus, your capitol city might have, at best I'd assume, 24,740 potential combatants, plus 151,060 first-level commoners that may be just brave enough, stupid enough, or patriotic enough to throw their fragile little lives away in your city's defense. I wouldn't hedge my bets on those young'un commoners having any real use in the combat, though. They might make a semi-effective delaying effect, for a little bit.