Pei Ji (570-629), courtesy name Xuanzhen, formally Duke of Hedong, was an important official and one-time chancellor of the Tang dynasty. He initially served as an official of the Sui dynasty and was one of the driving forces in persuading the general Li Yuan to rebel against Emperor Yang of Sui. He eventually assisted Li Yuan in founding the Tang dynasty as its Emperor Gaozu and was greatly honored in Emperor Gaozu's reign. After Emperor Gaozu's son Emperor Taizong became emperor in 626, Pei began to be accused of corruption and associations with witchcraft and was exiled. Emperor Taizong soon remembered Pei's contributions to Tang's founding and tried to recall him, but Pei died before he could do so.

Background 
Pei Ji was from Pu Province (蒲州, roughly modern Yuncheng, Shanxi), under Northern Zhou rule during the time of his birth. He was from "The Western Juan Pei" of the prominent Pei clan of Hedong. His father died early, and he was raised by his older brother.  When he was 13, he began serving as the secretary to a commandery governor.  He was described to be handsome and having a working knowledge of literature.  During the reign of Emperor Wen of Sui, he became an officer in the guard corps, but was said to be so poor that, in order to report to the capital Chang'an for duty, he had to walk there.

During the reign of Emperor Yang of Sui, he served successively as the census officer of Qi Province (齊州, roughly modern Jinan, Shandong), personal secretary to Emperor Yang, and then the deputy head of the household at Emperor Yang's secondary palace at Jinyang (晉陽, in modern Taiyuan, Shanxi).  He had already been friendly with Li Yuan the Duke of Tang, the general in charge at Taiyuan (i.e., Jinyang) previously, and when they were both posted to Taiyuan, Pei and Li became particularly close, often feasting together.  He also allowed Li Yuan to, against strict laws, have sexual relations with some of the ladies in waiting at Jinyang Palace, assumed by some historians as the main reason to rebel against Sui dynasty due to fear of severe punishment from the Emperor.

Participation in Li Yuan's rebellion 
Meanwhile, Li Yuan's son Li Shimin and Liu Wenjing, the Jinyang County magistrate, were plotting to rebel against Sui rule, but initially neither dared to discuss the matter with Li Yuan.  They saw that Pei was closest to Li Yuan, and therefore had their confederate Gao Binlian (高斌廉) gamble with Pei and intentionally lose to him.  After Gao got sufficiently close to Pei, he informed Pei of Li Shimin's and Liu's plot, and managed to persuade Pei to join.  Pei, in turn, persuaded Li Yuan that he had to rebel against Emperor Yang.  Li Yuan agreed, and did so in summer 617.  Once he did, Pei, who had considerably personal wealth and further had control of the storage facility, offered a large supply of rice, silk, and armor, as well as 500 ladies in waiting, to Li Yuan.  On Li Yuan's subsequent march toward Chang'an, Pei served as Li Yuan's secretary, and Li Yuan created him the Duke of Wenxi.

Later in 617, Li Yuan was attacking Hedong (河東, in modern Yuncheng) but could not capture it quickly, and there were rumors that Eastern Tujue and a rebel ruler it supported, Liu Wuzhou the Dingyang Khan, would attack Taiyuan.  At that time, Pei advocated withdrawing back to Taiyuan and defend it.  Li Shimin and another son of Li Yuan, Li Jiancheng, however believed that retreat would lead to inevitable defeat and therefore successfully persuaded Li Yuan not to retreat.  Instead, per Pei's suggestions, after Li Yuan subsequently defeated Sui forces at Huoyi (霍邑, also in modern Yuncheng), he left part of his army to siege Hedong, while himself crossing the Yellow River into Guanzhong (i.e., the Chang'an region).  After Li Yuan captured Chang'an later that year and declared Emperor Yang's grandson Yang You the Prince of Dai emperor (as Emperor Gong), he himself served as regent, and he awarded Pei with fields, a mansion, and the title of Duke of Wei.

During Emperor Gaozu's reign 
In 618, Emperor Yang was killed in a coup at Jiangdu (江都, in modern Yangzhou, Jiangsu) led by the general Yuwen Huaji.  When news of Emperor Yang's death reached Chang'an, Li Yuan had Yang You yield the throne to him, establishing Tang Dynasty as its Emperor Gaozu.  When he took the throne, he stated to Pei Ji, "The person who brought me here is you, Duke."  He made Pei the Right Shangshu Puye (尚書僕射), one of the two deputy heads of the executive bureau of the government (尚書省, Shangshu Sheng) -- a post that (at least in later times) was considered a post for a chancellor, and bestowed Pei with great treasures.  He also commissioned Pei and Liu Wenjing to revise the Sui laws.  Soon, however, Pei and Liu, who were previously friends, became enemies over their conflicting suggestions, and Liu was dissatisfied that he was ranked below Pei.  Subsequently, Liu was accused of using witchcraft to try to change his situation, and while Li Shimin and the officials Xiao Yu and Li Gang (李綱) all argued that Liu was not committing treason and should be spared, Emperor Gaozu, at Pei's suggestion, nevertheless executed Liu.

In 619, Liu Wuzhou captured Taiyuan, forcing Emperor Gaozu's son Li Yuanji the Prince of Qi to flee.  Liu then advanced south deep into Tang territory.  Pei volunteered to lead the army against Liu.  However, when he engaged Liu's general Song Jin'gang (宋金剛) at Dusuo Plain (度索原, in modern Jinzhong, Shanxi), Song cut off his water supplies and then defeated him, and he lost most of his soldiers.  He had to flee to Pingyang (平陽, in modern Linfen, Shanxi).  He sent a submission to Emperor Gaozu, requesting to be punished, but Emperor Gaozu did not punish him and continued to keep him in command of the forces in the region.  However, Pei, who was described to be fearful and not a capable general, was reduced to ordering the people into fortified cities, leaving the countryside for Liu to control and causing the dissatisfied people to rebel against Tang.  The situation became sufficiently severe that Emperor Gaozu considered abandoning the entire modern Shanxi region.  Li Shimin, however, argued that was inadvisable, and he led an army against Liu and Song, gradually fighting back and defeating Liu in 620, forcing Liu to flee to Eastern Tujue.  Meanwhile, Emperor Gaozu summoned Pei back to Chang'an and put him under arrest briefly, but soon released him and continued to honor him.  When Emperor Gaozu was away from Chang'an, he often had Pei in charge of the capital in his absence.  In 621, when Emperor Gaozu began minting new coins, he bestowed one mint press on Pei, allowing Pei to mint his own money, and he also took a daughter of Pei's to be the wife and princess of his son Li Yuanjing (李元景) the Prince of Zhao.  (Li Shimin and Li Yuanji, who were each granted three presses, were the only other individuals permitted to mint their own money.)  During the years, Pei offered several times to retire, and in 626, Emperor Gaozu granted him the honorific title of Sikong (司空) and allowed him to effectively retire, but further continued to set up rotations of junior officials from the executive bureau who would attend to Pei on a daily basis.

During Emperor Taizong's reign 
In 626, Li Shimin, then locked in an intense rivalry with Li Jiancheng (who, as the older brother, was crown prince), feared that Li Jiancheng was about to kill him, and ambushed Li Jiancheng and Li Yuanji (who supported Li Jiancheng) at Xuanwu Gate and killed them.  He then effectively forced Emperor Gaozu to create him crown prince and then yield the throne to him (as Emperor Taizong).  Although Pei Ji appeared to have supported Li Jiancheng in the struggle, Emperor Taizong initially continued to honor him, and on one occasion, when Emperor Taizong was offering sacrifices to heaven outside the capital, he requested Pei and Zhangsun Wuji to ride with him in the imperial wagon, a great honor at the time.

In 629, however, when the Buddhist monk Faya (法雅) was accused to have spread false teachings (probably treasonous teachings) to the people and was executed, Pei was accused of having heard of the false teachings but not reported it, and therefore was removed from his honorific title of Sikong and ordered to retire to his home in Pu Prefecture.  When Pei requested to stay at Chang'an, Emperor Taizong rebuked him:

Duke, your contributions were not commensurate with your position; you only rose to this honored position due to your relationship with Taishang Huang [(i.e., Emperor Gaozu, now retired emperor)].  There were times during the reign of Wude [(武德, Emperor Gaozu's era name)] when the government was corrupt and poorly run, and it was your fault.  Now I am allowing you to return to your home.  Why do you complain?

Once Pei returned to Pu Prefecture, an insane man named Xin Xing (信行) stated to one of Pei's servants that he believed that Pei would be emperor.  When Pei's servant reported this to the head servant, and the head servant in turn informed Pei, Pei, fearful, had Xin and the junior servant killed.  Subsequently, the head servant embezzled money from Pei and feared punishment, and therefore reported the incident to Emperor Taizong.  In anger, Emperor Taizong stated:

Pei Ji has four deadly crimes.  One, even though he was one of the Three Excellencies, he associated with witches.  Second, after he was removed from his post, he angrily stated that the empire rose only because of him.  Third, he failed to disclose the wicked words.  Four, he killed people to stop them from speaking.  I have reasons to execute him.

Many people spoke on Pei's behalf, and Emperor Taizong did not execute him, but exiled him to Jing Prefecture (靜州, roughly modern Heishui county in Aba Prefecture, Sichuan - see Jiu Tang Shu Ch Ch 45). At that time, the Qiang tribesmen in the region rebelled, and rumor arrived at Chang'an that they had taken Pei to be their leader. Emperor Taizong responded, "I have spared Pei, and he will surely not do this."  Soon, news arrived that Pei had led his servants in defeating the Qiang. Emperor Taizong, remembering Pei's contributions, issued an order recalling him to the capital, but before he could do so, Pei died. Emperor Taizong granted him a number of posthumous honors, including the title of Duke of Hedong.

Notes and references 

 Old Book of Tang, vol. 57.
 New Book of Tang, vol. 88.
 Zizhi Tongjian, vols. 183, 184, 185, 187, 188, 189, 190, 191, 192, 193.

570 births
629 deaths
Sui dynasty government officials
Chancellors under Emperor Gaozu of Tang
Politicians from Yuncheng
Tang dynasty generals from Shanxi
Pei clan of Hedong
Transition from Sui to Tang