BackgroundPreoperative prediction of prolonged postoperative opioid use (PPOU) after total knee arthroplasty (TKA) could identify high-risk patients for increased surveillance. The Skeletal Oncology Research Group machine learning algorithm (SORG-MLA) has been tested internally while lacking external support to assess its generalizability. The aims of this study were to externally validate this algorithm in an Asian cohort and to identify other potential independent factors for PPOU.MethodsIn a tertiary center in Taiwan, 3,495 patients receiving TKA from 2010–2018 were included. Baseline characteristics were compared between the external validation cohort and the original developmental cohorts. Discrimination (area under receiver operating characteristic curve [AUROC] and precision-recall curve [AUPRC]), calibration, overall performance (Brier score), and decision curve analysis (DCA) were applied to assess the model performance. A multivariable logistic regression was used to evaluate other potential prognostic factors.ResultsThere were notable differences in baseline characteristics between the validation and the development cohort. Despite these variations, the SORG-MLA (https://sorg-apps.shinyapps.io/tjaopioid/) remained its good discriminatory ability (AUROC, 0.75; AUPRC, 0.34) and good overall performance (Brier score, 0.029; null model Brier score, 0.032). The algorithm could bring clinical benefit in DCA while somewhat overestimating the probability of prolonged opioid use. Preoperative acetaminophen use was an independent factor to predict PPOU (odds ratio, 2.05).ConclusionsThe SORG-MLA retained its discriminatory ability and good overall performance despite the different pharmaceutical regulations. The algorithm could be used to identify high-risk patients and tailor personalized prevention policy.Supplementary InformationThe online version contains supplementary material available at 10.1186/s12891-023-06667-5.