Objective: Almost half of U.S. states have passed recreational cannabis laws as of May 2024. While considerable evidence to date indicates cannabis may be a substitute for prescription opioids in the treatment of pain, it remains unclear if patients are treating pain with cannabis alone or concomitantly with other medications. Method: Using data from a national sample of commercially insured adults, we examine the effect of recreational cannabis legalization (through two sequential policies) on prescribing of opioids, NSAIDS, and other pain medications by implementing synthetic control estimations and constructing case-study level counterfactuals for the years 2007-2020. Results: Overall, we find recreational cannabis legalization is associated with a decrease in opioid fills among commercially insured adults in the U.S., and we find evidence of a compositional change in prescriptions of pain medications more broadly. Specifically, we find marginally significant increases in prescribing of non-opioid pain medications after recreational cannabis becomes legal in some states. Once recreational cannabis dispensaries open, we find statistically significant decreases in the rate of opioid prescriptions (13% reduction from baseline, p < .05) and marginally significant decreases in the average daily supply of opioids (6.3% decrease, p < .10) and number of opioid prescriptions per patient (3.5% decrease, p < .10). Conclusions: These results suggest that substitution of cannabis for traditional pain medications increases as the availability of recreational cannabis increases. There appears to be a small shift once recreational cannabis becomes legal, but we see stronger results once users can purchase cannabis at recreational dispensaries. The decrease in opioids and marginal increase in non-opioid pain medication may reflect patients substituting opioids with cannabis and non-opioid pain medications, either separately or concomitantly. Reductions in opioid prescription fills stemming from recreational cannabis legalization may prevent exposure to opioids in patients with pain and lead to decreases in the number of new opioid users, rates of opioid use disorder, and related harms.