The κ-opioid receptor (KOR) represents a highly desirable therapeutic target for treating not only pain but also addiction and affective disorders1. However, the development of KOR analgesics has been hindered by the associated hallucinogenic side effects2. The initiation of KOR signalling requires the Gi/o-family proteins including the conventional (Gi1, Gi2, Gi3, GoAand GoB) and nonconventional (Gzand Gg) subtypes. How hallucinogens exert their actions through KOR and how KOR determines G-protein subtype selectivity are not well understood. Here we determined the active-state structures of KOR in a complex with multiple G-protein heterotrimers—Gi1, GoA, Gzand Gg—using cryo-electron microscopy. The KOR–G-protein complexes are bound to hallucinogenic salvinorins or highly selective KOR agonists. Comparisons of these structures reveal molecular determinants critical for KOR–G-protein interactions as well as key elements governing Gi/o-family subtype selectivity and KOR ligand selectivity. Furthermore, the four G-protein subtypes display an intrinsically different binding affinity and allosteric activity on agonist binding at KOR. These results provide insights into the actions of opioids and G-protein-coupling specificity at KOR and establish a foundation to examine the therapeutic potential of pathway-selective agonists of KOR.