PBA frameworks have stood out among metal–organic frameworks because of their easy preparation, excellent stability, porous structures, and rich redox properties. Unfortunately, their non-ideal conductivity and significant volume expansion during cycling prevent more widespread application in alkali-metal-ion (Li+, Na+, and K+) batteries. By changing the type and molar ratio of metal ions, Rubik’s PBA frameworks with infinite structural variations were obtained in this study, just like the Rubik’s cube undergoes infinite changes during the rotation. X-ray adsorption fine structure measurements have documented the existence and determined the coordination environment of the metal ions in the Rubik’s PBA framework. Benefiting from the more stable Rubik’s cube structures with diverse composition, enhanced conductivity, and greater adsorption capacity, the obtained Rubik’s cubes CoM-PBA anodes, especially CoZn-PBA deliver the enhanced cycling and rate performance in all the alkali-metal-ion batteries. The findings are supported by density functional theory calculations. Ex-situ X-ray photoelectron spectroscopy, and in-situ X-ray diffraction measurements were undertaken to explore the storage mechanism of CoZn-PBA anodes. Our results further demonstrate that the Rubik’s cube PBA framework-based materials could be widely applied in the field of alkali-metal-ion batteries.