The electric-thermo-hydrogen system(ETHS),a highly efficient and integrated energy supply system,has attracted widespread attentions.However,the explosive characteristics of hydrogen poses unique safety challenges.To ensure the safe and economical operation of ETHS,this paper proposes an optimal configuration method considering safety risks.Firstly,the safety of the ETHS is analyzed,and the working range and temperature of the electrolysis cells and fuel cell are constrained.Then,the pressure of the hydrogen storage tank is more accurately constrained using the non-ideal gas pressure formula of hydrogen,and the safety risk of the hydrogen storage tank is quantified using the TNT equivalent method.Furthermore,the safety risk coefficient is used to convert the safety risk of the hydrogen storage tank into the objective function.The optimal configuration model of the ETHS is then established with the system investment cost,operation cost,and safety risk as optimization objectives,and the tabu chaotic quantum particle swarm optimization(TCQPSO)algorithm is employed to solve the model.The case study results demonstrate that with consideration of safety risks,the economy of the system can be improved through reasonable capacity design while effectively reducing system safety risks,which verifies the effectiveness of the optimization design method proposed in this paper.