A smart city is a safe and productive metropolitan area that offers its residents a high standard of living through optimized resource planning. The advent of smart cities has allowed consumers to easily and reliably control home resources. In this regard, power control is a challenging activity, involving the optimal scheduling of connected devices to optimize electricity utilization. Therefore, this problem needs to be addressed with considerable attention and dedication. Several solutions are presented for energy optimization in smart cities, but not for real-time energy optimization. This paper introduces a hybrid smart grid that produces electricity from various sources Photovoltaic (PV), hydro and thermal power with a delivery system that satisfies energy optimization of the energy costs in real-time (ECRT) by considering the latency factor (FoL). This research aims to build resources in a smart grid (SG) for efficient control of power operations management. This paper models sustainable energy from all-natural sources and organized the proper energy distribution system at an optimized level for energy efficiency in a smart city. This paper presents various ideas and smart energy solutions that provide more advancement to several disciplines that concentrate on performance enhancement, smart and efficient resource utilization, and sustainable design.