The development of new energy storage equipment is of great significance to the development of implantable medical equipment. In this study, density functional theory (DFT) was used to study the two-dimensional nanomaterial TaS2 as anode material. It is found that potassium atoms can be adsorbed on the atoms of TaS2 substrate. The intrinsic TaS2 exhibits metallicity, and the shear deformation increases the band gap of TaS2 to 0.429 eV, which becomes a semiconductor property. In the O-doped TaS2 structure, the O-p orbital promotes the peak at the valence band. K shows different energy barriers on the surface of TaS2 and TaS2O, which are 0.289 and 0.243 eV, respectively. The theoretical capacity of K ion on TaS2 is 437.549 mAh/g. The average open circuit voltages of TaS2 and TaS2O are in the suitable voltage range.