The synthesis and characterisation of a three-dimensional lithium–organic framework MIL-145 is described, which upon thermal treatment yields a second open framework, MIL-146, that contains four and three-coordinate lithium centres: the coordinatively unsaturated trigonal planar lithium centres are able to reversibly bind water with crystallinity maintained, while the dehydrated phase shows preferential adsorption of CO2 over N2.