The automated generation of arbitrary exclusive final states produced via photon fusion in ultraperipheral high-energy collisions of protons and/or nuclei, A B $$ \overset{\upgamma \upgamma}{\to } $$
→
γγ
A X B, is implemented in the MadGraph5_aMC@NLO and HELAC-Onia Monte Carlo codes. Cross sections are calculated in the equivalent photon approximation using γ fluxes derived from electric dipole and charge form factors, and incorporating hadronic survival probabilities. Multiple examples of γγ cross sections computed with this setup, named gamma-UPC, are presented for proton-proton, proton- nucleus, and nucleus-nucleus ultraperipheral collisions (UPCs) at the Large Hadron Collider and Future Circular Collider. Total photon-fusion cross sections for the exclusive production of spin-0, 2 resonances (quarkonia, ditauonium, and Higgs boson; as well as axions and gravitons), and for pairs of particles (J/ψJ/ψ, WW, ZZ, Zγ, $$ t\overline{t} $$
t
t
¯
, HH) are presented. Differential cross sections for exclusive dileptons and light-by-light scattering are compared to LHC data. This development paves the way for the upcoming automatic event generation of any UPC final state with electroweak corrections at next-to-leading-order accuracy and beyond.