White House officials said this week that Mr. Trump had made it clear that he was unwilling to offer any concessions or negotiate for the release of the prisoners, and expressed confidence that Mr. Kim would respect that position and do the right thing anyway.

“It’s not unusual in diplomacy for people to be yelling at each other in one moment and singing kumbaya in the next, but what makes this so dramatic is that the president went further in both directions than others have,” said Peter D. Feaver, a political scientist at Duke University who was a national security official under George W. Bush. “I think that’s a reflection of his belief that we have to break the standard playbook here — we’ve tried everything else with North Korea and it hasn’t worked, so why not try something different?”

Few dispute that Mr. Trump has shattered the norms of diplomatic communication when it comes to his language about Mr. Kim — both positive and negative — and raised the stakes for the nuclear negotiations along the way.

“He has gone from extremely negative comments on Kim designed to frighten him into coming to the negotiating table to, now, extremely flattering comments designed to make him conclude a deal,” said Sue Mi Terry, a former C.I.A. analyst who is a senior fellow for Korea at the Center for Strategic and International Studies. “It’s just so over the top. No president has ever spoken in either way.”

The love-hate dynamic started during Mr. Trump’s candidacy in 2015, when he described Mr. Kim as “this maniac sitting there” with nuclear weapons who had to be dealt with. Once Mr. Trump became president, the insults continued. In 2016, Mr. Trump called the North Korean leader a “bad dude.” He became more heated in his denunciations over the summer after Mr. Kim tested a long-range missile that appeared capable of hitting the United States.

“Does this guy have anything better to do with his life?” the president wrote on Twitter. Weeks later, he vowed to rain down “fire and fury like the world has never seen” if North Korea continued to threaten the United States.

Mr. Trump brought his streetfighter-style words to the United Nations in September 2017 with another threat to Mr. Kim. “Rocket Man is on a suicide mission for himself and for his regime,” he said, a line that he embellished during a campaign rally in Alabama not long after, branding the North Korean leader “Little Rocket Man.”