Chemical reactions, which transform one set of substances to another, drive research in chemistry and biology. Recently, computer-aided chemical reaction prediction has spurred rapidly growing interest, and various deep learning–based algorithms have been proposed. However, current efforts primarily focus on developing models that support specific applications, with less emphasis on building unified frameworks that predict chemical reactions. Here, we developed Bidirectional Chemical Intelligent Net (BiCINet), a prediction framework based on Bidirectional and Auto-Regressive Transformers (BARTs), for predicting chemical reactions in various tasks, including the bidirectional prediction of organic synthesis and enzyme-mediated chemical reactions. This versatile framework was trained using general chemical reactions and achieved top-1 forward and backward accuracies of 80.6% and 48.6%, respectively, for the public benchmark dataset USPTO_50K. By multitask transfer learning and integrating various task prompts into the model, BiCINet enables retrosynthetic planning and metabolic prediction for small molecules, as well as retrosynthetic analysis and enzyme-catalyzed product prediction for natural products. These results demonstrate the superiority of our multifunctional framework for comprehensively understanding chemical reactions.