In a show of regained unity, OPEC oil ministers settled today on a unified base price of $34 a barrel for their crude oil exports and agreed to freeze prices at that level through 1982.

The agreement, which could raise oil prices slightly for U.S. consumers, returns the Organization of Petroleum Exporting Countries to a unified pricing system for the first time in nearly three years and holds out the promise of a more stable oil market through the coming year.

Under the agreement, reached after a day of closed-door meetings, Saudi Arabia, the dominant producer of the Organization of Petroleum Exporting Countries, will raise the price of its light crude by $2 a barrel in return for price reductions by most other OPEC states. The United States imports 30 percent of its oil, and 20 percent of these imports comes from Saudi Arabia.

The net effect of the OPEC decision will be "a slight increase" in the average world oil price, according to Indonesian Energy Minister Subroto, OPEC's president.

In the face of a continuing surplus on the world oil market, the oil ministers took the action toward unification in an effort to shore up eroding OPEC sales. They also clearly hoped to restore unity in a cartel weakened by disagreements since early 1979 over pricing and production levels.

"I had said rumors about OPEC's death were wrong," Kuwait's oil minister, Sheik Ali Khalifa Sabah, declared, referring to previous speculation that the disarray was bringing OPEC to ruin. "Today, I think we proved" the rumors wrong, he said.

The pricing agreement, which takes effect "not later than Nov. 1," also assigned price differentials of up to $4 a barrel above the $34 base or $2.50 below, depending on the oil quality and geographical locations.

Saudi Arabia had led the drive for the new $34 price -- the benchmark from which other OPEC prices are calculated. By deliberately overproducing, the Saudis contributed to a world oil glut and to a decline in sales and oil prices of its higher priced OPEC partners.

Saudi Oil Minister Ahmed Zaki Yamani, leaving the meeting hotel here, told reporters that his country could be expected to cut its oil production following today's agreement. He said an announcement would come Friday. Other ministers said future OPEC production levels had not been discussed at today's meeting.

In a "good-will" gesture last August, Saudi Arabia cut production by 1 million barrels a day to 9 million barrels, which still left it with 45 percent of OPEC production. Industry sources estimate that Saudi oil output rose to 9.5 million barrels a day this month.

Some industry experts here said today they doubted that Saudi Arabia would be willing or able to slash its production enough to allow other OPEC members to regain lost market shares in the face of a continued slump in world oil demand. These experts saw today's pricing agreement as providing some relief for OPEC, but hardly solving the organization's problems.

One factor working against a quick pickup in OPEC sales is the fullness of oil company inventories, which are expected to be drawn down in coming months. In view of this and a general depressed demand for oil, the spread in OPEC prices approved today -- particularly the $4 a barrel surcharges granted to Algeria and Libya, producers of higher quality crudes -- were seen by some as too high.

"It was a face-saving solution," said Antoine Saadi, London-based vice president of Cities Service Co. "I don't think the market will support it."

As part of an evident compromise, Nigeria, another exporter of high-quality crude, agreed to a $3 premium after slashing its differential to $2.50 last week in a desperate bid to regain sales.

Several OPEC ministers indicated that the question of price differentials would be looked at again at a regular OPEC meeting scheduled in Abu Dhabi on Dec. 9.

"We are going to look at the differential question in Abu Dhabi because we couldn't reach a complete, firm agreement on figures which could last for long," said the United Arab Emirates oil minister, Sheik Mana Said Oteiba. "So we decided until then to have an interim agreement."

There had been some speculation that OPEC, and particularly Saudi Arabia, might hesitate in reaching a pricing decision today in view of the U.S. Senate's approval yesterday of the sale of radar planes and other weaponry to the Saudis. But OPEC delegates, while welcoming the U.S.-Saudi arms deal as contributing to Persian Gulf security, said there was no connection between the AWACS sale and OPEC prices.

"The conference is aware," the ministers said in a communique, "that this pricing decision will have an evident positive effect over the economy of the world through an organization of the oil market, which in turn will contribute also to the consolidation of OPEC as the main hydrocarbon supplier to the international market, thus maintaining its relevance as an energy source."

Until the announcement of a decision early this evening, there had been few clues during the day of what the outcome would be.

Staying clear of the main conference room, where they had met in the past, the ministers gathered for their talks this time in Subroto's hotel suite, well out of reach of the throng of reporters in the lobby.

OPEC has not had a unified price structure since early 1979. The Iranian revolution and the Iranian-Iraqi war tightened the oil market to allow OPEC price hawks to break ranks with moderates and run up their prices.

Concerned that the high oil prices were accelerating a switch in the industrialized world to alternative energy sources, permanently spoiling the demand for oil, Saudi Arabia began this year publicly pushing for price unity and keeping its production of relatively cheap oil at an unusually high level.

The high Saudi production contributed to an oil glut. It also angered other OPEC states. But it reinforced Saudi Arabia's image as an OPEC moderate, especially in the United States while the AWACS sale was being considered.

Meantime, a combination of fuel conservation, use of energy alternatives and slow growth in big consuming countries pushed down the demand for OPEC oil to about 20 million barrels a day, roughly 25 percent less than at this time last year. But while the Saudis kept selling oil others lost considerably. Libya, a longtime OPEC hawk, suffered a drop in production from 1.7 million barrels a day to less than 600,000.