Assuming the generalized Riemann hypothesis, we give asymptotic bounds on the size of intervals that contain primes from a given arithmetic progression using the approach developed by Carneiro, Milinovich and Soundararajan [Comment. Math. Helv. 94, no. 3 (2019)]. For this we extend the Guinand-Weil explicit formula over all Dirichlet characters modulo q ≥ 3, and we reduce the associated extremal problems to convex optimization problems that can be solved numerically via semidefinite programming.