BackgroundThe relationship between opioid craving and opioid use is unclear. We sought to determine to what extent craving mediated the relationship between opioid agonist therapy and changes in opioid use. MethodsData came from a pragmatic, 24-week, pan-Canadian, multi-centric, open-label, randomized controlled trial comparing flexible buprenorphine/naloxone take-home doses to standard supervised methadone models of care for the treatment of prescription-type opioid use disorder. Participants were randomly allocated to buprenorphine/naloxone or methadone models of care. 270 people with prescription-type opioid use disorder were included in analyses. There were 93 women (34.4%) and 2 transgender (0.7%) participants. Most participants were white (67.4%), 45.9% reported unstable living conditions, and 44.8% had psychiatric comorbidities. Generalized linear mixed models followed by mediation analysis estimated the direct effect of treatment group on Timeline Followback-reported next-week opioid use and the indirect effect through past 24-hour opioid craving measured using the Brief Substance Craving Scale at week 2, 6, 10, 14, 18 and 22. ResultsUpon mediation analysis, the average direct effect of treatment on opioid use was 0.465 (95 % CI = 0.183 to 0.751, p < 0.001). The average causal mediated effect was 0.144 (95 % CI = 0.021 to 0.110; p < 0.001). Craving accounted for 23.6 % of the effect of treatment on opioid use (p < 0.001). ConclusionsPast 24-hour craving was associated with increased next-week opioid use; however, craving only partially mediated the effect of buprenorphine/naloxone and methadone on next-week opioid use. Research is needed to develop a comprehensive understanding of factors mediating opioid use during opioid agonist therapy.