The pretreatment immune environment, including pretreatment intratumoral immune cell infiltration or PD-L1 expression on cancer cells or antigen-presenting cells, predicts the efficacy of anti-PD-1 therapy across tumor types. Here, CD274 is linked to cancer.