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_x^2+ χJ_y^2) + ω_0J_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.