The shootout at Camp Shaheen near northern Mazar-i-Sharif city is the second "green-on-blue" attack -- where Afghan soldiers turn their weapons on international forces assisting them -- reported this week.
It comes as Washington is expected to announce an increase in the US military deployment in the country to bolster Afghan forces who are struggling to contain the Taliban's nationwide offensive.
"Seven US service members wounded, evacuated for treatment," US-led NATO forces said in a brief statement on Twitter. "Insider attack Camp Shaheen, Mazar-e Sharif under investigation."
The Taliban in a statement did not say if they were directly behind the attack, only crediting a "patriotic Afghan soldier" for the assault.
More From This Section
The latest attack comes just a week after an Afghan commando killed three American troops and wounded another in eastern Nangarhar province, in an insider attack that was claimed by the Taliban.
Camp Shaheen is the headquarters of the Afghan army's 209th Corps where around 150 Afghan soldiers and policemen were killed in April when it was stormed by Taliban fighters dressed in military uniforms and armed with suicide vests.
Analysts say such attacks are expected to increase this year as US troops engage with the Afghan military to double the size of its special forces, considered to be effective in the fight against insurgents.
The latest insider attack comes at a time of intensified violence and when the United States is actively considering sending more troops to Afghanistan.
Defense Secretary Jim Mattis said this week that he will present a new US military strategy for Afghanistan, along with adjusted troop numbers, in the coming weeks to President Donald Trump.
US troops in Afghanistan currently number about 8,400, with another 5,000 from NATO allies, who mainly serve in a training and advisory capacity.
The Afghan conflict is the longest in American history, with US-led forces at war there since 2001, after the ousting of the Taliban regime.