The embodiments of the present disclosure relate to a code editing method and device, and a device and a storage medium. The method provided herein comprises: sending to a target model an editing request which is associated with a target code, wherein the editing request indicates an output format of the target model, and the output format instructs the target model to output a
code snippet, which needs to be replaced, and a
code snippet, which needs to be updated, in a code file to be edited; acquiring response content which is output by the target model on the basis of the output format, wherein the response content comprises a first
snippet to be replaced, and a second
snippet used for replacing the first
snippet; and generating an editing result of the target code by means of
parsing the response content. In this way, the embodiments of the present disclosure can improve the output efficiency and accuracy of a target model.