We show that ultracold polar molecules pinned in an optical lattice can be used to access a variety of exotic spin models, including the Kitaev honeycomb model. Treating each molecule as a rigid rotor, we use DC electric and microwave fields to define superpositions of rotational levels as effective spin degrees of freedom, while dipole–dipole interactions give rise to interactions between the spins. In particular, we show that, with sufficient microwave control, the interaction between two spins can be written as a sum of five independently controllable Hamiltonian terms proportional to the five rank-2 spherical harmonics Y 2, q (θ, φ), where (θ, φ) are the spherical coordinates of the vector connecting the two molecules. To demonstrate the potential of this approach beyond the simplest examples studied in [S.R. Manmana et al., Phys. Rev. B. 87, 081106 (2013)], we focus on the realisation of the Kitaev honeycomb model, which can support exotic non-Abelian anyonic excitations. We also discuss the possibility of generating spin Hamiltonians with arbitrary spin S, including those exhibiting SU(N=2S+1) symmetry.