Air quality forecasting is a significant method of protecting public health because it provides early warning of harmful air pollutants. In this study, we used correlation analysis and artificial neural networks (ANNs; including wavelet ANNs [WANNs]) to identify the linear and nonlinear associations, respectively, between the air pollution index (API) and meteorological variables in Xi'an and Lanzhou. Evaluating twelve algorithms and nineteen network topologies for the ANN and WANN models, we discovered that the optimal input variables for an API forecasting model were the APIs from the 3 preceding days and sixteen selected meteorological factors. Additionally, the API could be accurately predicted based solely on the value recorded 3 days earlier. Based on the correlation coefficients between the air pollution index of the targeted day and the tested variables, the API displayed the closest relationship with the API 1 day earlier as well as stronger correlations with the average temperature, average water vapor pressure, minimum temperature, maximum temperature, API 2 days earlier, and API 3 days earlier. When Bayesian regularization was applied as a training algorithm, the WANN and ANN models accurately reproduced the APIs in both Xi'an and Lanzhou, although the WANN model (R = 0.8846 for Xi'an and R = 0.8906 for Lanzhou) performed better than the ANN (R = 0.8037 for Xi'an and R = 0.7742 for Lanzhou) during the forecasting stage. These results demonstrate that WANNs are effective in short-term API forecasting because they can recognize historic patterns and thereby identify nonlinear relationships between the input and output variables. Thus, our study may provide a theoretical basis for environmental management policies.