This paper addresses the problems of quantum spectral curves and 4D limit for the melting crystal model of 5D SUSY U (1) Yang-Mills theory on R 4 ×S 1 . The partition function Z(t) deformed by an infinite number of external potentials is a tau function of the KP hierarchy with respect to the coupling constants t = (t 1 , t 2 , . . .). A single-variate specialization Z(x) of Z(t) satisfies a q-difference equation representing the quantum spectral curve of the melting crystal model. In the limit as the radius R of S 1 in R 4 × S 1 tends to 0, it turns into a difference equation for a 4D counterpart Z 4D (X) of Z(x). This difference equation reproduces the quantum spectral curve of Gromov-Witten theory of CP 1 . Z 4D (X) is obtained from Z(x) by letting R → 0 under an R-dependent transformation x = x(X, R) of x to X. A similar prescription of 4D limit can be formulated for Z(t) with an R-dependent transformation t = t(T , R) of t to T = (T 1 , T 2 , . . .). This yields a 4D counterpart Z 4D (T ) of Z(t). Z 4D (T ) agrees with a generating function of all-genus Gromov-Witten invariants of CP 1 . Fay-type bilinear equations for Z 4D (T ) can be derived from similar equations satisfied by Z(t). The bilinear equations imply that Z 4D (T ), too, is a tau function of the KP hierarchy. These results are further extended to deformations Z(t, s) and Z 4D (T , s) by a discrete variable s ∈ Z, which are shown to be tau functions of the 1D Toda hierarchy.