Cai Yan, courtesy name Wenji, was a Chinese composer, poet, and writer who lived during the late Eastern Han dynasty of China. She was the daughter of Cai Yong. Her courtesy name was originally Zhaoji, but was changed to Wenji during the Jin dynasty to avoid naming taboo because the Chinese character for zhao in her courtesy name is the same as that in the name of Sima Zhao, the father of the Jin dynasty's founding emperor, Sima Yan. She spent part of her life as a captive of the Xiongnu until 207, when the warlord Cao Cao, who controlled the Han central government in the final years of the Eastern Han dynasty, paid a heavy ransom to bring her back to Han territory.