李元吉
In 621, with Li Shimin leading the army in besieging Luoyang, the capital of Wang Shichong's rival Zheng state, Li Yuanji served as Li Shimin's assistant. When subsequently another rival ruler, Dou Jiande the Prince of Xia, came to Wang's aid, Li Shimin left Li Yuanji at Luoyang to continue the siege and to watch Wang, while he himself advanced to Hulao Pass to engage Dou. Li Shimin defeated and captured Dou at the Battle of Hulao, and Wang, in fear, surrendered. Li Shimin received the most honors stemming from the victory, but Li Yuanji also received promotions and honors. Subsequently, when Emperor Gaozu had the government mint new coins, there were strict prohibitions against minting by any other persons, except that Li Shimin and Li Yuanji were each granted the right to have three mints and Pei Ji was granted the right to have one mint. Later that year, when Dou's general Liu Heita rose in resistance to Tang rule and took over all of Dou's former territory, Li Shimin and Li Yuanji were sent against him. Li Shimin defeated Liu in spring 622, forcing Liu to flee to Eastern Tujue. Subsequently, they attacked another rebel leader, Xu Yuanlang the Prince of Lu, when Li Shimin returned to Chang'an and left Li Yuanji in charge of the operations against Xu. Meanwhile, however, Liu returned from Eastern Tujue and again occupied Dou's old territory, and Li Yuanji was not able to stop him.