당 고조
Meanwhile, Emperor Gaozu of Tang, who had established Tang Dynasty in spring 618 and wanted to enter an alliance with Li Gui to attack Xue Ju's successor Xue Rengao, sent messengers to Li Gui, calling him "younger cousin." Li Gui was pleased, and he sent his brother Li Mao () to the Tang capital Chang'an to greet Emperor Gaozu. Emperor Gaozu, in response, sent his official Zhang Qide () to Wuwei to commission Li Gui as the commandant of Liang Prefecture (i.e., Wuwei) and created him the Prince of Liang. Before Zhang could arrive at Li Gui's domain, however, Li claimed imperial title (as the Emperor of Liang) in winter 618. He created his son Li Boyu () as crown prince.