In 732, Emperor Xuanzong commissioned his second cousin Li Hui () the Prince of Xin'an to command an army against Khitan and Xi tribes which would not submit to Tang suzerainty, with Pei as Li Hui's deputy. After Li Hui scored a major victory over both the Khitan and the Xi, Emperor Xuanzong ordered Pei to tour the Xi tribes that were submissive and which had participated in the campaign, to award a large amount of silk to them. Pei, realizing that such a journey would be filled with danger as other tribes might become aware and might attack, proceeded quickly on the trip and divided his train into several groups, awarding the silk quickly and then returning to Tang territory. Indeed, hearing about Pei's tour, Eastern Tujue and Shiwei forces launched a raid against him, but by the time that they arrived, Pei had already returned to Tang territory. In winter 732, he was made the mayor of Jingzhao Municipality (), which encompassed Chang'an.