There's a lot of reasons for the Japanese surrender.
The trigger was the possibly of annihilation by untold numbers of American nukes.
The only reason the war carried on as long as it did was because of fanatics in the Japanese military.
Except we didn't have "untold numbers of nukes".
In fact, we only had the two.
So you have to keep in mind what the Japanese War goal was. It was to retain parts of its empire, get a reasonable peace, and then dominate the region economically through all the puppet governments it set up across Asia.
And the key part of that was Manchuko (Manchuria) under the puppet Emperor, Puyi.
Once it was clear they were going to lose Manchuria and Korea, their goal was to get the best deal from the Americans they could.
Contrariwise, for the Americans, the prospect of the Soviets taking the lion's share of the spoils in Asia as they had in Europe was frightening, so we dropped our insistence that Hirohito abdicate and be treated as the war criminal he obviously was.
The real objective for both the US and USSR wasn't really Japan, it was China. A prolonged war in Asia would have left the Soviets in control of much of China, with a very credible alternative to Chiang Kai-shek in the person of Mao Zedong.
(Which is of course, what ended up happening anyway when the Chinese Civil War resumed.)