The nanopore confinement effect can increase the mobility for gas flow in shale rocks, and the apparent permeability is usually adopted to account for this effect. However, most of the apparent permeability calculation models are derived based on straight channels (capillaries) and neglect the influence of end effect. The end effect is caused by the bending of streamlines which yields more viscous dissipation and additional flow resistance for gas flow in nanoporous media. In this paper, for the first time the viscous dissipation for gas flow in nanoporous media is analyzed. In addition, an improved apparent permeability calculation model is proposed based on the Beskok‐Karniadakis (B‐K) model by introducing the influence of end effect, which is characterized by the ratio of the length to the width of a short channel (L/H). The accuracy of this model is validated by lattice Boltzmann simulations of gas flow in three different geometries: an infinite‐length straight channel, a finite‐length straight channel, and nanoporous media. For the infinite‐length straight channel, there is no end effect therefore both the B‐K model and the improved model can well predict the apparent permeability. However, for the finite‐length straight channel and nanoporous media, the original B‐K model overestimates the gas apparent permeability as it neglects the influence of end effect, while the improved model can still well predict the gas apparent permeability. In summary, the improved apparent permeability calculation model is more reasonable in predicting gas mobility in nanoporous media.