After the fall of the Qin dynasty, Liu Bang received the title of "King of
Han" from Xiang Yu, and was relocated to
Hanzhong. Liu Bang granted Cao Shen the title of "Marquis of Jiancheng" () and promoted him to a general rank. Cao Shen helped Liu Bang conquer the
Three Qins. During the
Chu–Han Contention, a power struggle between Liu Bang and Xiang Yu, Cao Shen joined
Han Xin's army in the campaigns on the northern front. They scored victories against
Wei Bao's forces, the
Zhao army at the
Battle of Jingxing, and the combined forces of
Qi and
Chu at the
Battle of Wei River. During this time, Cao Shen was appointed as acting-Left
Chancellor of Liu Bang's Han kingdom, and subsequently promoted to Right Chancellor. After the conquest of the Qi kingdom, Cao Shen left Han Xin and returned to Liu Bang's side to join him in resisting Xiang Yu. Liu Bang later sent Cao Shen to suppress the remnants of Qi. In 202 BC, Liu Bang defeated Xiang Yu at the
Battle of Gaixia and unified China under his rule. Liu Bang became the
Emperor and his dynasty was named "
Han". He was historically known as "Emperor Gao" (or Emperor Gaozu). When rewarding his subjects, Gaozu named Cao Shen as the person who made the most contributions in battle. However, Cao Shen resigned from his post as Right
Chancellor. In 201 BC, Cao Shen was appointed as chancellor of
Qi Kingdom, which was then ruled by
Liu Fei (Gaozu's eldest son). He was also conferred the title of "Marquis of Pingyang" () and given 10,630 households in his marquisate. ==As chancellor==