A series of Ni-imidazolate cubic cages, one-dimensional and two-dimensional coordination polymers based on the cubic cages, have been prepared by solvothermal subcomponent self-assembly of 5-methyl-4-formylimidazole, m-xylylenediamine, and Ni(II) salts with varied anions. These compounds have been characterized by single-crystal X-ray diffractions, elemental analysis, IR spectra, and powder X-ray diffractions. The formation of an oligomerized coordination cage or an infinite coordination polymer depends on the anions chosen. An oligomerized 8-nuclear Ni-imidazolate cubic cage is formed when the anion Cl(-), Br(-), I(-), SCN(-), NO2(-), or NO3(-) is utilized in the reactions, and a two-dimensional coordination polymer based on the Ni-imidazolate cubic cage will be obtained when N3(-), (CN)2N(-), or (CN)3C(-) act as the anions. When only ClO4(-) or both ClO4(-) and [Ni(C4N2S2)2](2-) (C4N2S2 = dimercaptomaleonitrile) as anions exist in the reaction mixture, a ladder-like one-dimensional coordination polymer based on the Ni-imidazolate cubic cage and formate is formed unpredictably.