In a city that’s known for never sleeping, it’s important to have food that never sleeps either. Who hasn’t felt blessed by the occasional 4 a.m. deli sandwich at the 24-hour bodega a round the corner? Or the city-based sacrament of a hot plate of food that arrives just before the sun peeks through the windows of the diner?

Now, in the Upper East Side, New Yorkers (quite literally) have the icing on the whole late night cake. Join us, fellow sweet-toothed night owls, in transacting at the Cupcake ATM, a wondrous machine that dispenses the handheld confections any time of the day.

This ingenious cupcake robot is attached to 780 Lexington Avenue, between 60th and 61st Streets, where the folks at Sprinkles bake fresh morsels all day long — and into the wee hours of the night. “I conceived the idea of an automatic cupcake machine after having late-night sugar cravings while pregnant with my second son,” says Candace Nelson. “Even as Sprinkles’ founder, I couldn’t get my midnight cupcake fix! I thought ‘there has to be a way’ and so the concept of the Sprinkles Cupcake ATM was born!”

The whole thing is simple to use, and the design is sleek, like the kind of thing we’d expect to see in Back to the Future Part 2. Tiny pizzas become full-sized meals and a cotton-candy pink machine on the side of a building turns out cupcakes topped with thick coats of icing — only the latter is real, and we love it. Candace and her crew at Sprinkles put together a video showing how it all works here. Mosey on up to the touch screen, pick a flavor, swipe your card, and boom. Cupcake arrives in a neat cardboard box, ready to be sacrificed to your sweet tooth.

The first Cupcake ATM opened up on March 6, 2012 in Beverly Hills, California. Since then, Sprinkles has rightfully spread their automated desserts across the country. What can we expect to munch on at the New York outpost? The folks at the bakery assured us that “while the adjacent bakery is only open for business 12 hours a day, behind the scenes, it is essentially a 24-hour operation.” So, basically, “a cupcake from the ATM will have been baked only a couple hours prior, regardless of the time it is purchased.”

And, yes, they’ll have every flavor that’s available inside the bakery – so late-night folks aren’t missing out on rich red velvet or flaky coconut. All told, the machine can dispense up to four cupcakes, cookies and even special “doggie cupcakes” at a time. Plus, we hear the New York version can hold 760 cupcakes (plenty to go around).

An ice cream shop is also slated to open up this month next door. No word yet on whether we’ll be getting 24-hour ice cream to go with our cupcakes, but aren’t the possibilities endless? Pie ATMs? Cronut ATMs? The future is a promising place, people.