In this study, the nanoboxes is converted into Au-Ag alloy nanocages by increasing the hole size. Discrete dipole approximation (DDA) is used to study the extinction spectrum and the refractive index sensing characteristics of Au-Ag alloy nanocages with different geometric parameters. With the increase of Au component, the local surface plasmon resonance (LSPR) peak shows approximately linear redshift and the sensitivity factor shows approximately linear decrease. The refractive index sensitivity can be effectively controlled by the Au-Ag ratio at large hole size because the hole and cavity surfaces distribute more environmental dielectric components. Therefore, increasing the hole size and decreasing the Au-Ag ratio can improve the refractive index sensitivity. To explain the effect of alloy composition on the LSPR characteristics and the refractive index sensitivity, the local electric field distributions with different geometric parameters are plotted. We find that the electric field direction on the hole and cavity surfaces are controlled by the Au-Ag ratio and environmental dielectric constant. Moreover, the field vector on the hole and cavity surfaces are formed by the superposition of the incident field, the electric field generated by the oscillating electrons on the outer surface, and the polarized field in the environmental dielectric constant.