At one point, he served as the eunuch monitor of the army at Rong District (容管, headquartered in modern Yulin, Guangxi).
[1] During the time that Emperor Xizong's brother Emperor Zhaozong was in exile at Hua Prefecture (華州, in modern Weinan, Shaanxi)[1] — i.e., from 896 to 898[2] — he gave Zhang the greater title of Zhong Changshi (中常侍) and sent him to Lulong Circuit (盧龍, headquartered in modern Beijing), to serve as Lulong's eunuch monitor.
Liu Rengong sought aid from Li Keyong the military governor of Hedong Circuit (河東, headquartered in modern Taiyuan, Shanxi).
[5] Liu sent Zhang and the secretary Ma Yu (馬鬱) with an army to Hedong, to join the attack on Zhaoyi.
Shortly after, Later Liang launched an army to put Zhaoyi's capital Lu Prefecture (潞州) under siege.
[1] In 923, Li Cunxu was planning to declare himself emperor of a new Later Tang, and therefore summoned Zhang and the assistant to the military governor of Anyi (安義, i.e., Zhaoyi, changed to Anyi to observe naming taboo for Li Sizhao), Ren Huan, to his presence at Wei Prefecture (魏州, in modern Handan, Hebei).
[8] As he thought that Li Cunxu summoned Zhang and Ren to prepare to act against him, he thus submitted the circuit to Later Liang's emperor Zhu Zhen.
After Li Cunxu conquered Later Liang later in the year,[7] he gave Zhang a grand general title and put him in charge of the eunuch bureau (內侍省, Neishi Sheng), but continue to have him serve as a chief of staff with Guo.