ObjectivesThe study aimed to develop a genotypic antimicrobial resistance testing method for Klebsiella pneumoniae using metagenomic sequencing data. MethodsWe utilized Lasso regression on assembled genomes to identify genetic resistance determinants for six antibiotics (Gentamicin, Tobramycin, Imipenem, Meropenem, Ceftazidime, Trimethoprim/Sulfamethoxazole). The genetic features were weighted, grouped into clusters to establish classifier models. Origin species of detected antibiotic resistant gene (ARG) was determined by novel strategy integrating “possible species,” “gene copy number calculation” and “species-specific kmers.” The performance of the method was evaluated on retrospective case studies. ResultsOur study employed machine learning on 3928 K. pneumoniae isolates, yielding stable models with AUCs > 0.9 for various antibiotics. GenseqAMR, a read-based software, exhibited high accuracy (AUC 0.926–0.956) for short-read datasets. The integration of a species-specific kmer strategy significantly improved ARG-species attribution to an average accuracy of 96.67%. In a retrospective study of 191 K. pneumoniae-positive clinical specimens (0.68–93.39% genome coverage), GenseqAMR predicted 84.23% of AST results on average. It demonstrated 88.76–96.26% accuracy for resistance prediction, offering genotypic AST results with a shorter turnaround time (mean ± SD: 18.34 ± 0.87 hours) than traditional culture-based AST (60.15 ± 21.58 hours). Furthermore, a retrospective clinical case study involving 63 cases showed that GenseqAMR could lead to changes in clinical treatment for 24 (38.10%) cases, with 95.83% (23/24) of these changes deemed beneficial. ConclusionsIn conclusion, GenseqAMR is a promising tool for quick and accurate AMR prediction in Klebsiella pneumoniae, with the potential to improve patient outcomes through timely adjustments in antibiotic treatment.