Metal–organic frameworks have emerged as promising electrode materials for metal-ion batteries due to their superior structural customizability. However, they face challenges such as poor reversibility and easy degradation during electrochemical redox processes. Here, we report the synthesis of
π-d
conjugated coordination polymers through NH
3
-vapor-assisted self-polymerization of NiCl
2
·6H
2
O with 1,2,4,5-benzenetetramine tetrahydrochloride (namely, Ni-BTA). The synthesized Ni-BTA exhibits an open lattice structure that enhances the capacity for metal-ion diffusion, ensuring prolonged electrochemical cycling stability. Moreover, electrochemical characterizations reveal that Ni-BTA functions as a bifunctional material, serving as both cathode and anode materials for lithium-ion batteries (LIBs). After 1,000 cycles at 1.0 A g
−1
, the cathode and anode show high discharge capacities of 199.7 and 338.4 mAh g
−1
, respectively. Additionally, symmetrical all-organic batteries constructed with Ni-BTA exhibit a high specific capacity of 30.6 mAh g
–1
and an ultrastable coulombic efficiency of approximately ≈100% after 6,000 cycles at 1.0 A g
−1
. Furthermore, Ni-BTA exhibits versatility as a robust cathode for aluminum ion batteries (AIBs), delivering a discharge capacity of 18.7 mAh g
−1
after 10,000 cycles at 1.0 A g
−1
. These findings highlight the potential of Ni-BTA as a versatile and durable electrode materials for both LIBs and AIBs.