EXCLUSIVE

Katy Perry is getting a staggering $25 MILLION to judge "American Idol" ... this according to sources familiar with the negotiation.

Multiple sources tell us ABC was desperate to sign a name before the Upfronts last week, when honchos announced she was the lead judge. As one source put it, "Katy had all the leverage. If ABC ended up announcing the show without a judge, they'd be screwed."

TMZ broke a story way back in 2012 that 'A.I.' was trying to get Katy as a judge but she rejected the network's $20 mil offer.

As we reported, ABC tried to get Kelly Clarkson but at the last minute she jumped ship and went to NBC's "The Voice." NBC also snagged Jennifer Hudson.