During the Yonghui era of Emperor Taizong's son and successor Emperor Gaozong, Li Anqi served as a mid-level official at the legislative bureau of government (中書省, Zhongshu Sheng), and later served as Huangmen Shilang (黃門侍郎), the deputy head of the examination bureau (門下省, Menxia Sheng). As of 666, when Emperor Gaozong was offering sacrifices to heaven and earth at Mount Tai, Li Anqi was serving as the deputy minister of civil service, and Emperor Gaozong had him author the text for the monument at the altar.