Black is one piece up, but Qxf7 checkmate is threatened. Maybe I am missing something, but I do not see any other way to defend but 1...Nd7 2. Qxd7, followed by 2...Qc1+ and 3...Qf4+ . Then I go for perpetual moving the queen between c1 and f4.
How defend this position?

Not sure how I came across this, but here is what I see.
Nd7, QxN Qc1+, Kh2 Qf4+, g3 (forced) QxB regaining material and defending f7.
If Nd7, QxN Qc1+, Kh2 Qf4+, Kg1 then Ra1 forces mate as the h2 square is covered by the queen, creating a mating net. No need for perpetual, black is won
Black to move,