Mental health and substance use and abuse disorders have been associated with poor patient-reported outcomes. Despite the prevalence of hip fractures in the United States, the relationship between opioid demand and these factors in hip fracture surgery is not well understood. The purpose of this study is to describe opioid filling volume and rates after hip fracture surgery and to identify mental health risk factors for increased demand. The study hypothesis is that psychiatric comorbidities such as depression and psychoses as well as substance use and abuse indicators such as pre-op opioid dependence, drug, alcohol, and tobacco abuse would be associated with increased perioperative opioid demand. This is a retrospective cohort study of 40,514 patients undergoing surgical fixation of hip fractures using a commercially available insurance database. The primary patient-level outcome was filled opioid prescription volume in oral morphine milliequivalents converted to oxycodone 5-mg equivalents up to 1-year post-op. Adjusted measures of overall quantities filled and refill rates were assessed with multivariable main effects linear and logistic regression models. Twenty four thousand four hundred forty-one of 40,514 patients (60.3%) filled opioid prescriptions within 7 days pre-op to 1-year post-op. Patients filling prescriptions filled a mean of 187.7 oxycodone 5-mg equivalents. Sixteen thousand five hundred seventy-seven patients (41.1%) filled two or more opioid prescriptions within 7 days pre-op to 1-year post-op. Fifteen thousand two hundred seventy-nine patients (37.7%) filled an opioid prescription between 3 months post-op and 1-year post-op, and 8,502 patients (21%) filled an opioid prescription between 9 months post-op and 1-year post-op. In multivariable models, age, pre-op opioid filling, depression, tobacco abuse, and drug abuse were risk factors significantly associated with increased perioperative opioid filling. Psychoses had a mixed effect on outcomes with decreased early perioperative filling and increased late perioperative filling. Pre-op opioid filling had the largest impact on perioperative opioid demand. Pre-op opioid filling and drug abuse were the main mental health-related drivers of increased perioperative opioid prescription filling. Depression, psychoses, alcohol abuse, and tobacco abuse had small effects on prescription filling. These results can help identify patients at risk for increased opioid demand who may benefit from additional counseling, maximizing alternative pain management strategies, and possible referral to pain management specialists. Level III, retrospective, prognostic cohort study.