The kingdom of Cheshi 車師 (Türkic names Yarkhoto, Turpan and Jimasa), in early times also called Gushi 姑師, was located in the area of modern Jimsar 吉木薩爾 north of the Turfan Basin. The kingdom was divided into two parts, namely Fore Cheshi (Qian Cheshi 前車師, Qianguo Cheshi 前國車師, Cheshi qianguo 車師前國 or Cheshi qianbu 車師前部, geographically seen from the Chinese perspective) which was reigned from the city of Jiaohe 交河, and Rear Chechi (Hou Cheshi 後車師, Houguo Cheshi 後國車師, Cheshi houguo 車師後國 or Cheshi houbu 車師後部) that was located in the Wutu Valley 務涂谷.
To the northeast and north of Cheshi, several smaller polities were known many of which were later conquered by Cheshi or Yanqi 焉耆. These were Huhu 狐胡, Pulei 蒲類, Yizhi 移支, Yulishi 郁立師, Beilu 卑陸, Jie 劫, Qiemi 且彌, Danhuan 單桓 and Wutanzili 烏貪訾離.
The inhabitants of the two kingdoms lived from settled agriculture, but also from pastoral nomadism. They seemed to have spoken a Türkic language. Their rulers had to pay tributes to the Xiongnu 匈奴. In 108 BCE Zhao Ponu 趙破奴 was the first Chinese general attacking Cheshi and forcing it under the supremacy of the Han empire 漢 (206 BCE-220 CE). Cheshi declared its vassal status to the Han in 89 BCE.
In the next decades the Xiongnu and the Han empire fought for the dominance over Cheshi. The Han court therefore sent out Zheng Ji 鄭吉 to establish military agro-colonies (tuntian 屯田) in Quli 渠犁 whose fields were to be worked by people from Cheshi. The Xiongnu on their side enthroned a new king, Dou-mo 兜莫. From that time on, Cheshi was divided in two parts, Fore Cheshi being controlled by the Chinese, and Rear Cheshi by the Xiongnu. In the year 60 BCE the Xiongnu khan Ri-zhu 日逐 submitted to the Han, and from then on Cheshi was administered by the Chinese Protector-general of the Western Territories (Xiyu duhu 西域督護).
In the year 48 BCE a military colony was set up on the territory of Fore Cheshi, the commandery (xiaowei 校尉) of Wuji 戊己. At that time Fore Cheshi had 700 households, Rear Cheshi 600. During the Later Han period 後漢 (25-220 CE) these had increased to 1,500 and 4,000, respectively. The protectorate was dissolved during the usurpation of Wang Mang 王莽 (r. 8-23 CE), and after the foundation of the Later Han dynasty, eighteen states of the Western Territories sent an embassy to the Han court with the request to reestablish the protectorate.
Emperor Guangwu 漢光武帝 (r. 25-57) declined and left the statelets managing their own affairs. Rear Cheshi thereupon conquered some smaller states in the neighbourhood. The remaining states Qiemi, Beilu, Pulei, Yizhi and the two Cheshi were therefore also known by the name of "the six Cheshi" (Cheshi liuguo 車師六國).
In 74 CE the Chinese generals Dou Gu 竇固 and Geng Bing 耿秉 forced Cheshi into submission. Two years later Cheshi had to be liberated from the Xiongnu, but only in 90 CE the steppe federation could be repelled so far that there was no further danger of Xiongnu intrusions for a decade. Instead, there was a conflict between the king of Rear Cheshi, Zhuo-di 涿鞮, and that of Fore Cheshi, Wei-bei-da 尉卑大. The Han general Wang Lin 王林 executed Zhuo-di and replaced him by his younger brother. In 107 again, the Xiongnu controlled the whole region and had to be expelled by general Suo Ban 索班 who took his seat in Yiwu 伊吾. Suo Ban was killed by Jun-jiu 軍就, the king of Rear Cheshi, in 120. General Ban Yong 班勇 appeased Fore and Rear Cheshi only in 126 CE and appointed new rulers to the two kingdoms. The Xiongnu khan Hu-yan 呼衍 continued harrassing Rear Cheshi until he was defeated in 137. In 153 the king of Rear Cheshi, A-luo-duo 阿羅多, rebelled against the Han empire, but had to seek refuge among the Xiongnu when his successors did not follow him. He later returned and was pardoned by the Han emperor.
During the turbulent period of the Sixteen Barbarian States 五胡十六國 (300~430), Cheshi was located in the commandery (jun 郡) of Gaochang 高昌, but remained an independant polity in the territory controlled by the dynasties of Former Liang 前涼 (314-376), Later Liang 後涼 (386-403) and Northern Liang 北涼 (398-439). Under the Northern Wei dynasty 北魏 (386-534), the ruler of Cheshi was given the formal title of palace attendant (shizhong 侍中) and was appointed Grand commander-in-chief (da duwei 大都尉). The kingdom was finally extinguished in 450 when general Juqu Anzhou 沮渠安周 besieged the city of Jiaohe. King Che Yi-luo 車伊洛 fled to Yanqi and gave up his throne.
The state of Huhu 狐胡, also called Guhu 孤胡, was located in the valley of Cheshiliu 車師柳谷 near modern Turfan 吐魯番, Xijiang. During the Former Han period, it had a population of no more than 200 persons. The king was aided by a Commander Supporting the State (fuguohou 輔國侯) and two commanders-in-chief (duwei 都尉). The Han subjected it to the Protector-general of the Western Territories. During the Later Han period, it was several times conquered by Cheshi, but was able to win independence again.
The state of Jie 劫國 was located in the valley of Danqu 丹渠谷 in the eastern parts of the Tianshan Range 天山, within the terrritory of modern Changji 昌吉, Xinjiang. During the Former Han period, the population was 500 persons. The king of Jue was aided by a Marquis Supporting the State (fuguohou 輔國侯), a commander-in-chief (duwei 都尉) and a chief translator (yizhang 譯長). It was administered as part of the Protectorate of the Western Territories.
The state of Yizhi 移支 was located in the territory of modern Balikun (Barköl) 巴里坤, Xinjiang. It was during the Later Han period inhabited by 3,000 persons. The warriors of Yizhi were famous for their fierce style of fighting and their threatening appearance because of the dishevelled hair. The people lived as pastoral nomads on a territory that was formerly part of the kingdom of Pulei.
The state of Danhuan 單桓 was located in the area of modern Ürümchi 烏魯木齊, Xinjiang. During the Former Han period, the population as not larger than 190 persons. The king was aided by a Marquis Supporting the State (fuguohou 輔國侯), a general, a left and a right Commander-in-chief (duwei 都尉), and a chief translator (yizhang 譯長). Danhuang belonged to the Protectorate of the Western Territories of the Han empire. In the 3rd century CE it was occupied by Rear Cheshi.
The state of Yulishi 郁立師 was located in the valley of Neiduo 内咄谷 in the area of modern Jimsar 吉木薩爾, Xinjiang. During the Former Han, it was inhabited by 1,400 persons. The king was aided by a Marquis Supporting the State (fuguohou 輔國侯), a left and a right Commander-in-chief (duwei 都尉), and a chief translator (yizhang 譯長). Yulishi belonged to the Protectorate of the Western Territories of the Han empire.
The state of Wutanzili 烏貪訾離 was located in the valley of Yulei 于類谷 in the territory of modern Hutubi 呼圖壁, Xinjiang. During the Former Han period, their city was inhabited by not more than 230 persons. The king was aided by a Commander Supporting the State (fuguohou 輔國侯), and a left and a right Commander-in-Chief (duwei 都尉). Wutanzili came into being when part of the tribes living in Eastern Pulei 東蒲類 fled the domination of the steppe federation of the Xiongnu and submitted to the Protectorate of the Western Territories (Xiyu duhufu 西域都護府) of the Han empire. The 1,700 persons were settled down and built the state of Wutanzili. In the 3rd century CE it was occupied by Rear Cheshi.