The speaker’s tough stance on differences with the president came as Mr. Obama pursued his outreach to Congressional Republicans, this time in the Senate. For almost an hour and a half, the president and Senate Republicans jousted cordially on entitlement spending, the Keystone XL pipeline, the White House’s role on immigration proposals and whether an overhaul of the tax code should generate more revenues through higher taxes or only economic growth.

Neither side offered concrete movement toward the other, but the president and Senate Republicans agreed they had a narrow window — perhaps through July — to reach an accord, and both sides agreed to try.

“I specifically said, to get to a big deal you have to work with us. You have to grind it out with us until we get there. You can’t break off and say, ‘Oh, Congress has to do it,’ ” said Senator John Hoeven, Republican of North Dakota, who added that Republicans and the president agreed the window would most likely close by July. That is when Republicans could pick a fight over the debt ceiling and when Mr. Obama said the politics of the midterm elections would begin to take hold.

Representative Nancy Pelosi of California, the House Democratic leader, also struck a conciliatory note in an interview, saying she was open to examining a change in the way the government calculates inflation to slow the growth of Social Security and other benefit programs, while slowly boosting tax revenues.

That tone contrasted sharply with the direction House Republicans are taking. Although Mr. Boehner expressed some hope that the divided Congress could reach a deficit accord, he gave little indication that Mr. Obama’s overtures to House Republicans had yielded tangible movement.