It is not known when Li Keju was born. His father Li Maoxun was ethnically Huigu, of the Abusi tribe. In 875, Li Maoxun, then an officer of Lulong Circuit, overthrew then-military governor Zhang Gongsu in a mutiny and took over control of the circuit, and was subsequently commissioned by Emperor Xizong to be military governor. In 876, Li Maoxun requested retirement and recommended Li Keju to succeed him. Emperor Xizong permitted Li Maoxun to retire. He made Li Keju acting military governor, and full military governor later in the year.
As military governor
In 878, when Li Keyong the son of the Shatuo chieftain Li Guochang rebelled and seized Datong Circuit, and was subsequently joined in rebellion by his father Li Guochang, Li Keju was one of generals whose army that Emperor Xizong ordered to mobilize against Li Guochang and Li Keyong, along with Li Junthe military governor of Zhaoyi Circuit, the Tuyuhun chieftains Helian Duo and Bai Yicheng, and Sage chieftain Mi Haiwan. When Li Keju subsequently launched his attack against Li Keyong, Li Keyong stationed himself at Xiongwu Base to defend against Li Keju, leaving his officer Gao Wenji at Shuo Prefecture —but the new Tang-commissioned military governor of Datong, Li Zhuo, then persuaded Gao to surrender Shuo to him. When Li Keyong subsequently returned to Shuo to try to take it, Li Keju had his officer Han Xuanshao intercept Li Keyong, crushing Li Keyong's army and killing some 7,000 soldiers, before again defeating Li Keyong at Xiongwu Base. When Li Guochang was subsequently defeated by Li Zhuo and Helian, Li Guochang and Li Keyong were forced to abandon Datong Circuit and flee to the Dada tribes. For his contributions, Li Keju was bestowed the honorary chancellor title of Shizhong. In 882, Li Keyong tried to return to Datong Circuit, and he engaged both Helian and Li Keju, defeating both, although he was subsequently repelled by Zheng Congdang the military governor of Hedong Circuit and forced to return north.
Death
By 885, Li Keyong, who had again become a Tang subject and made major contributions in Tang's defeat of the agrarian rebel Huang Chao, was the military governor of Hedong and controlled several nearby circuits as well. He was also an ally to Wang Chucun the military governor of Yiwu Circuit. Both Li Keju and Wang Rong the military governor of Chengde Circuit were fearful of Li Keyong's growing strength, and therefore formed a pact to conquer Yiwu and divide its territory. They also persuaded Helian to attack Li Keyong to occupy him so that he could not save Li Chucun. In spring 885, they launched the attack, with Li Keju sending 60,000 soldiers under his officer Li Quanzhong to attack Yi Prefecture, one of Yiwu's two prefectures, while Wang Rongattacked Wuji. Initially, the Lulong attack was successful, as Li Quanzhong's subordinate Liu Rengong captured Yi by digging a tunnel into it. However, Li Keyong, despite Helian's attack, came to Yiwu's aid himself and repelled the Chengde attack at Wuji and Xincheng, forcing the Chengde forces to withdraw. Meanwhile, the Lulong forces had become overly confident after capturing Yi. Wang Chucun sent 3,000 soldiers disguised as sheep at night to approach Yi. The Lulong soldiers, believing that they were sheep, opened the city gates to seize them. Wang Chucun then attacked, defeating Li Quanzhong and recapturing Yi. Li Quanzhong, believing that Li Keju would punish him for this defeat, decided to turn against Li Keju. He gathered his remaining troops and attacked Lulong's capital You Prefecture. Li Keju could not resist the attack. He took his family onto a tower and burned it to commit suicide. Li Quanzhong took over the circuit as acting military governor.