After two months of nerve-wracking negotiations with international banks, Brazil has succeeded at the 11th hour in obtaining much of the financing it needs to survive 1983, but with significant reductions in its demands and some brutal sacrifices that havedampened economic optimism in the country.

In New York Friday, senior economic ministers will sign contracts sealing two of the four complex loan proposals that were put to international bankers December 20. On Monday, the IMF is expected to give formal approval to a $4.9 billion credit for Brazil that had been linked with agreement between commercial banks and Brazil.

The agreement between Brazil and its major creditors will be greeted with relief in financial circles. But many bankers caution that the nation may need more money later this year.

The Brazilians had been saying for some time that agreement on three parts of the four point rescue plan was close. But signing of the contracts has been postponed at least three times. The delay has been partly caused by problems in putting together the fourth part of the plan, involving short-term loans and deposits to Brazilian banks by foreign banks.

Although this part of the plan is still not complete, banks have decided to go ahead with agreement on the two contracts for a $4.4 billion "jumbo" loan of new money and the rollover of $4.7 billion of debts due in 1983. Banking sources in New York said that the gap between the Brazilian request for short-term loans to Brazilian banks and the commitments made so far has been shrinking and is now down to less than $500 million. "There is a feeling of optimism that this will be enough to do the job," one source said.

Small U.S. banks have been "recalcitrant" in putting up the money requested for the fourth part of the loan, sources said. But big banks have put in more money, and in the last few days, foreign banks have also increased their commitments, sources said, adding that big banks hoped that there would be some "redistribution of the burden" in coming days so as to lessen their share.

This part of the plan and the third part, which deals with trade financing, do not require signing, sources in New York said.

The agreement to go ahead with signing the two contracts reportedly comes on the final day of the period permitted by International Monetary Fund Executive Director Jacques de Larosiere, sources said. It was known in Washington on Tuesday that the IMF had decided to go ahead with the formal board consideration of the Brazilian credit as scheduled next Monday.

One Brazil-based U.S banker said that, once the argument about the IMF not approving Brazil's plans was taken away, "some banks won't run to put back cut credit lines quite so quickly," to complete project four. "If I was playing poker, I'd do the same," he said.