After claiming it would go rogue in the Big Apple, the ride-sharing app Lyft caved in to regulators on Friday and agreed to immediately start offering the service using only black cars in compliance with city law.

The San Francisco-based company reached an agreement with the city Friday in Manhattan Supreme Court. It also reached a deal with state Attorney General Eric Schneiderman to halt its Buffalo and Rochester operations by Aug. 1 for not following state regulations on insurance.

“We don’t believe any city law has the jurisdiction to do anything to these drivers,” co-founder John Zimmer had said earlier this month. “We feel we are not tied to these laws.”

But a judge slapped Lyft with a restraining order on July 11 four hours before hundreds of New Yorkers planned to hit the road moonlighting as cabbies for ­“donations.”

Since then, Lyft has purchased a black-car base in Bay Ridge, Brooklyn, and signed agreements with 14 other car bases, according to court papers. Service then kicked off Friday evening citywide.

All Lyft drivers are licensed by the TLC as for-hire vehicle drivers, who undergo drug and criminal-background tests.

The only similarity Lyft will have to its operations in other cities such as Los Angeles and Boston is that its New York cars will sport fuzzy pink mustaches.

However, the fuzz will be on the dashboard rather than on the front grillwork.

The company is following the path of car-service-app competitor Uber, which has six black-car bases and TLC-licensed drivers.

In New York City, a Lyft trip will cost a minimum of $8, which includes a $3 pickup charge. Each mile is $2.15.

Yellow taxis charge a passenger $2.50 to enter a cab, but another $2.50 per mile.

Passengers who bail on Lyft drivers who come to pick them up through its app will be hit with a $5 penalty.

Lyft’s business model in other cities is much different and asks passengers to give drivers a suggested donation.

Yellow-taxi-industry officials hailed the city and state on Friday for getting Lyft to follow the rules.

But Lyft still wants to bring ride sharing to New York City and will submit a pilot proposal to the TLC, according to court papers.

“This agreement is the first big step in finding a home for Lyft’s peer-to-peer model in New York,” the app operators said.

Taxi drivers have slammed Lyft’s ride-sharing model as an insult to their profession and picketed a kickoff party the company held in Bushwick last month.

When a Post reporter tried to summon a Lyft ride Friday evening, the company’s app said, “All drivers are currently busy.”

When the reporter tried again later the app still said drivers were busy and added that a 75 percent tip would be added to the fare to encourage drivers.

“We are pleased to welcome Lyft as a fully licensed for-hire service in New York City, and appreciate their having fulfilled their commitment to the TLC and to the court to act within the law,” said TLC Chairwoman Meera Joshi.