When Alex Belton and her fiancé started their search for a single-family house in San Francisco last fall, their budget was $1.2 million. After being repeatedly outbid, it has increased to $1.5 million, and they have switched their search to Marin County, where the median home price is slightly lower.

“Our new pastime is crunching numbers because I just feel like we’re just constantly trying to re-evaluate and see, ‘Can we afford to up the budget?’” said Ms. Belton, who works as a nurse in the city.

The median home sale price in the San Francisco metro area increased more than 10 percent in April from a year earlier, to $1.7 million, according to a recent report by Redfin. The metro area now boasts the highest median home price in the country. The shift comes after San Francisco’s national reputation plunged during the pandemic when headlines about petty crime, public drug use and tent encampments raised worries over its future. The city’s constrained housing supply has added to that pressure.

Since the launch of ChatGPT in 2022, home prices in the Bay Area’s luxury ZIP codes have sharply risen, as prices in the most affordable ZIP codes have fallen, according to recent data from Redfin. The divergence in growth rates between luxury and non-luxury markets did not exist before ChatGPT’s release and is not common in other major markets.

“What’s different this time is that the benefits or the prosperity of A.I. seems much more concentrated,” said Daryl Fairweather, the chief economist at Redfin. “It’s not that everybody is going out and buying homes.”

For Mason McDowell, a real estate agent in San Francisco for about 10 years, demand from all-cash buyers seemed to spike overnight in mid-October last year and has not let up. This coincided with a moment when more than 600 current and former OpenAI employees sold their shares, The Wall Street Journal reported, making $6.6 billion collectively. Some of Mr. McDowell’s clients working in the A.I. industry were, at times, offering millions of dollars over the asking price in all cash, agreeing to quickly close and waiving contingencies, such as the right to inspect the house before buying.

“I wrote multiple offers for all of these clients that were a million dollars over the asking price, and we weren’t even close to being competitive,” he said.

Alexander Fromm Lurie, executive vice president of City Real Estate in San Francisco — and the half-brother of Mayor Daniel Lurie — said most of the buyers he works with on homes listed at $5 million or more have benefited from the A.I. gold rush, either as employees or investors, and are making all-cash offers.

The competitive housing market goes beyond the A.I. frenzy, he added, noting that return-to-office mandates have also contributed to the booming market.

“This has been the most robust market we have ever seen,” said Mr. Fromm Lurie, who has worked in the city’s real estate market for more than 12 years.

Just a day after Mr. Fromm Lurie and his business partner listed a four-bedroom, five-bathroom house for $3,995,000 in Pacific Heights earlier this month, it received multiple offers and sold for $7 million a week later. The neighborhood is among the most expensive in the country.

Anthropic and OpenAI, the tech industry’s leading start-ups, are headquartered in San Francisco, where many of their employees work from offices in the city. Many real estate agents said they expect strong housing demand to continue, as OpenAI prepares to file for an initial public offering in the coming weeks, and Anthropic has also taken steps to go public. An I.P.O. boom would likely create a new flood of generational wealth.

Residential rents in the city have also soared in recent years, driven by the same factors.

Ms. Belton, 33, and her fiancé rented a two-bedroom, two-bathroom apartment in the Marina District for $3,695 in 2020, when the city’s rental prices were low amid the Covid-19 pandemic. This year, rent increased by about 10 percent, to $4,075, making their search to buy feel more urgent.

The irony is that even though Ms. Belton knows the A.I. boom is making it harder for her to buy, she is still using artificial intelligence to help her buy a home.

“It’s funny that A.I. is part of the problem here, but we’ve actually been using Claude,” she said. “We’ve been using A.I. to crunch our numbers.”