Significance: Design of nanostructured protein materials is a big challenge due to structural complexity. Even more challenging is the design of protein nanomaterials endowed with specific properties and functions. Here, we report a prototype oxygen-impermeable protein nanocage assembled from the pentameric vertex protein of β-carboxysomes, CcmL, through nanoparticle templating. We solved the structure of the cage at the atomic scale by integrating solid-state NMR spectroscopy and cryoelectron microscopy and designed a molecular patch to the pores of the cage based on the structure, establishing a gating mechanism for reversible control of the oxygen permeability. The CcmL cage can serve as a protein nanoplatform for oxygen-sensitive or -responsive storage, catalysis, delivery, sensing, etc.