Synthetic gauge fields have recently emerged, arising in the context of quantum simulations, topological matter, and the protected transportation of excitations against defects. For example, an ultracold atom experiences a light-induced effective magnetic field when tunneling in an optical lattice, and offering a platform to simulate the quantum Hall effect and topological insulators. Similarly, the magnetic field associated with photon transport between sites has been demonstrated in a coupled resonator array. Here, we report the first experimental demonstration of a synthetic gauge field in the virtual lattices of bosonic modes in a single optomechanical resonator. By employing degenerate clockwise and counterclockwise optical modes and a mechanical mode, a controllable synthetic gauge field is realized by tuning the phase of the driving lasers. The nonreciprocal conversion between the three modes is realized for different synthetic magnetic fluxes. As a proof-of-principle demonstration, we also show the dynamics of the system under a fast-varying synthetic gauge field, and demonstrate synthetic electric field. Our demonstration not only provides a versatile and controllable platform for studying synthetic gauge fields in high dimensions but also enables an exploration of ultrafast gauge field tuning with a large dynamic range, which is restricted for a magnetic field.