Identifying valid biomarkers for patient selection impressively promotes the success of anti-PD-1 therapy. However, the unmet need for biomarkers in gastrointestinal (GI) cancers remains significant. We aimed to explore the predictive value of the circulating T-cell receptor (TCR) repertoire for clinical outcomes in GI cancers who received anti-PD-1 therapy. 137 pre- and 79 post-treated peripheral blood samples were included. The TCR repertoire was evaluated by sequencing of complementarity-determining region 3 (CDR3) in the TRB gene. The Shannon index was used to measure the diversity of the TCR repertoire, and Morisita’s overlap index was used to determine TCR repertoire similarities between pre- and post-treated samples. Among all enrolled patients, 76 received anti-PD-1 monotherapy and 61 received anti-PD-1 combination therapy. In the anti-PD-1 monotherapy cohort, patients with higher baseline TCR diversity exhibited a significantly higher disease control rate (77.8% vs. 47.2%; hazard ratio [HR] 3.92; 95% confidence interval [CI] 1.14–13.48; P = 0.030) and a longer progression-free survival (PFS) (median: 6.47 months vs. 2.77 months; HR 2.10; 95% CI 1.16–3.79; P = 0.014) and overall survival (OS) (median: NA vs. 8.97 months; HR 3.53; 95% CI 1.49–8.38; P = 0.004) than those with lower diversity. Moreover, patients with a higher TCR repertoire similarity still showed a superior PFS (4.43 months vs. 1.84 months; HR 13.98; 95% CI 4.37–44.68; P