Multi-mode cavities have now attracted much attention both experimentally and theoretically. In this paper, inspired by recent experiments of cavity-assisted Raman transitions, we realize a two-axis spin Hamiltonian H = q(J 2x + χJ 2 y ) + ω 0 J z in two cavities. This realized Hamiltonian has a distinct property that all parameters can be tuned independently. For proper parameters, the well-studied one-and two-axis twisting Hamiltonians are recovered, and the scaling of N −1 of the maximal squeezing factor can occur naturally. On the other hand, in the two-axis twisting Hamiltonian, spin squeezing is usually reduced when increasing the atomic resonant frequency ω 0 . Surprisingly, we find that by combining with the dimensionless parameter χ(> −1), this atomic resonant frequency ω 0 can enhance spin squeezing greatly. These results are beneficial for achieving the required spin squeezing in experiments.