In this paper, a bi-level optimization model including the problem of transmission network market and energy management in the distribution substation is presented. In the proposed bi-level model, the lower-level includes the demand-side management (DSM) program and the optimal charge/discharge of large-scale energy storage system (LSESS) at distribution substations to increase grid profits and send decisions to the upper-level transmission market operator. The upper level of the proposed model is a security-constrained unit commitment (SCUC) to minimize production, no-load, startup, shutdown, and active power curtailment costs, and also the unavailability of the generation units. In this paper, to solve the bi-level optimization problem, the Karush-Kuhn-Tucker (KKT) equation modeling method will be used to turn the problem into a single-level problem. One of the advantages of converting a bi-level model to a single-level model compared to the methods of the decomposition algorithms is the lack of use of iterative algorithms, which leads to an increase in problem-solving time. The proposed model is tested on standard distribution substations and transmission networks, which shows that the proposed method is more effective than decomposition algorithms in terms of problem solving time. The simulation results showed that the proposed method can be more efficient in large optimization problems.