SAN FRANCISCO  If electric cars have any future in the United States, this may be the city where they arrive first.

The San Francisco building code will soon be revised to require that new structures be wired for car chargers. Across the street from City Hall, some drivers are already plugging converted hybrids into a row of charging stations.

In nearby Silicon Valley, companies are ordering workplace charging stations in the belief that their employees will be first in line when electric cars begin arriving in showrooms. And at the headquarters of Pacific Gas and Electric, utility executives are preparing “heat maps” of neighborhoods that they fear may overload the power grid in their exuberance for electric cars.

“There is a huge momentum here,” said Andrew Tang, an executive at P.G.& E.

As automakers prepare to introduce the first mass-market electric cars late this year, it is increasingly evident that the cars will get their most serious tryout in just a handful of places. In cities like San Francisco, Portland, Ore., and San Diego, a combination of green consciousness and enthusiasm for new technology seems to be stirring public interest in the cars.