Kanshi (漢詩?) is a Japanese term for Chinese poetry in general as well as the Japanese poetry written in Chinese by Japanese poets. It literally means "Han poetry". Kanshi was the most popular form of poetry during the early Heian period in Japan among Japanese aristocrats and proliferated until the modern period.
The earliest collection of kanshi was the Kaifūsō, compiled in 751. The Kaifūsō was also one of the earliest works of Japanese literature, and according to Judith Rabinovitch and Timothy Bradstock, it was a collection of occasional verse spanning from 672-751. The compiler of the Kaifūsō may have been Omi no Mifune, Isonokami no Yakatsugu, or Prince Shirakabe and Fujiwara no Satsuo. Three imperial collections of kanshi were compiled during the 9th century: the Ryōunshū of 814, the Bunka Shūreishū of 818, and the Keikokushū of 827. Indeed, kanshi was accorded a higher place than the native waka form until the Kokin Wakashū collection was published in 905. Even before the early Heian period, the word shi (詩) meaning "poetry" was automatically understood to refer to kanshi, while the character 歌 (ka/uta) of waka 和歌 referred to Japanese poetry proper.
The Shi Jing, great Chinese poets of the Six Dynasties and Tang dynasty, such as Bai Juyi and others influenced the Japanese kanshi poets of the time, and when the Japanese met foreign diplomats of the time, they communicated in Chinese writing. Some went to China for study or diplomatic relations, and learned under Chinese poets such as Li Bai and Du Fu. Important kanshi poets of the Heian period included Kūkai, who learned to speak Chinese fluently during his time studying in China, Sugawara no Michizane, who did not study in China, but had a good understanding of Chinese, and Shimada no Tadaomi, among many others. Emperor Saga was a notable kanshi poet, who even ordered the compilation of 3 anthologies of kanshi, the first three imperial anthologies. Also noteworthy are private collections of Chinese poetry. One such collection combined both kanshi and waka: cf. the Wakan rōeishū.