This paper proposes an optimization mechanism of energy cluster for a zero energy town (ZET), which is to maximize the efficiency of energy cluster. The energy cluster includes energy loads, distributed energy resources, energy storage systems and a connection to grids in a town. Even a town consists of a mix of zero energy buildings (ZEBs) and non-ZEBs, the town could be a ZET by using energy cluster. However, if peak power is not properly managed, the energy cost of a town may not be similarly reduced. To optimize the energy cluster in a ZET, the proposed mechanism predicts energy demand and energy generation, decides whether to import energy from grids or export energy to grids and controls the energy resources in the town. In addition, the mechanism mitigates the peak power of the delivered and exported energy.