Longxi Commandery (Chinese: trad. 隴西郡, simp. 陇西郡, Lǒngxījùn) was a commandery of imperial China in present-day Gansu, named due to its location west of Mount Long (the southern portion of Mount Liupan).
Established by Shi Huangdi, it originally covered the entire territory of the Qin Empire west of Mount Long with its seat at Didao (present-day Taoyang in Lintao County). This area included most of the upper Wei valley. Its principal route of communication was the Long Road (named for the mountain), which probably passed along the course of the modern railroad west from Xi’an although much of the area nearest the river was then marshland. The territory was used as a staging ground for campaigns up the Tao and the upper Yellow River.
The first governor was Li Chong (李崇), considered the originator of an important clan of the Li family.
The Emperor Wu of the Han dynasty, as part of his expeditions into the Tarim Basin, established Tianshui Commandery to control the Wei valley immediately to the west of Mount Long. The southern parts of the old commandery controlling the Han and Bailong were reörganized as Wudu. The remnant of Longxi controlled eleven counties in the far west of the Wei and the Tao valley.
The Long Road into the territory was militarized: garrisons and arsenals were maintained and patrols organized. The entry to the lower Wei was removed from the valley itself to the then-forested loess foothills north of Mount Long. The narrowest point—the Long Pass—was fortified.
From the time of the Empress Lü (c. 190 BC), the area was repeatedly attacked by the Xiongnu.
By the time of the Western Jin, the commandery had only four counties.
Under the Sui, it increased to five.
Under the Tang, the commandery was folded into Wei Prefecture (渭州). Its name was carried on by Longxi County.