The transient stability constraint should be taken into consideration for the solution of the optimization problems in power systems. This paper presents a solution for the transient stability-constrained optimal power flow (TSCOPF) by a novel approach based on the artificial bee colony algorithm. The formulas of TSCOPF are derived through the addition of rotor angle inequality constraints into optimal power flow relationships. In this nonlinear optimization problem, the objective function is taken into consideration as the fuel cost of the system. The proposed approach is tested on both a WSCC 3-generator, 9-bus system and a IEEE 30-bus system, and the test results obtained are compared to prove the efficiency and effectiveness of the approach with other approaches in the literature.