The new Ford class carriers have a nuclear reactor in them that outputs about 2x as much power as the ship actually needs. If/when these are ready for prime time, prepare or some raves on the flight deck!
$0.23 for a round of 5.56, $0.76 for a round of 7.62. Ish.
Keep in mind, too, that lasers fire in about as straight a line as you can hope for, while bullets do not. It's going to take a lot more bullets fired to neutralize a target than laser "rounds" fired.
The US has been playing with these kinds of lasers for over a decade now. Last I saw a demonstration, the laser wasn't powerful enough to just zap something. It had to focus on a warhead and heat it up until it exploded. It wouldn't work on a missile in flight. Maybe they improved it, but I suspect the introduction of slow drones like the Iranian Shahed made it feasible.
The cost per shot was pennies a decade ago. But how fast can they shoot these? It must be able to shoot fast and constantly if you want to deal with swarms.