Incidentally, this situation ended up being the nail in the coffin for the Soviet Union. The Soviets had been forced to import a lot of grain in the eighties and they were paying for it with oil exports, since that was really the only export that the west was interested in buying from the Soviets.
When oil crashed in the mid eighties, the Soviets were forced to look for hard currency loans from the west to keep up food imports. These loans were then tacitly conditioned on the Soviets behaving themselves in Eastern Europe. When the Solidarity protests started up in Poland and the Monday demonstrations started in East Germany, the normal Soviet response (as in 1956 and 1968) to roll tanks was not an option, because it would have meant no more loans, no more grain, and the starvation of the Soviet population.
Who was making the loans to the Soviets specifically? For all the hard rhetoric of the 80s, it's quite interesting that the West was willing to prop up a (Communist!!!) entity for a fee.
"In retrospect, it is possible to see that bank confidence had begun to
erode as early as the latter part of 1988. In the fall of that year, new
patterns of bank lending to the Soviet Union appeared. Previously, it
was typical for banks from many nations to participate in syndications for loans to the Soviet Union. Beginning in October 1988,
though, a number of very large loans were negotiated with purely
national syndications-that is, all participating banks were from a
single Western country. Western governments played important
roles in arranging these syndications, and usually the loans were to
finance exports from the lending country. At the time, a number of
Western governments were intent on providing material support for
the processes of economic and political reform perceived to be under
way in the Soviet Union. By intervening with banks on behalf of the
Soviet Union-either directly through loan guarantees or through
less formal encouragement of bank lending-these governments probably helped the Soviet Union to achieve better terms from the banks
than it could have gotten on its own. By mid-1990, bank confidence
had declined sufficiently that banks would lend to the Soviet Union
only with explicit guarantees from Western governments."
To answer your question though, I believe it was primarily Western European countries providing or guaranteeing the funds by 1989.
At the time, Gorbachev was seen as a reformer, and the West was willing to grant him some rope in the form of hard currency loans, but that would have evaporated if he had pulled a Prague in Warsaw or East Berlin.
When oil crashed in the mid eighties, the Soviets were forced to look for hard currency loans from the west to keep up food imports. These loans were then tacitly conditioned on the Soviets behaving themselves in Eastern Europe. When the Solidarity protests started up in Poland and the Monday demonstrations started in East Germany, the normal Soviet response (as in 1956 and 1968) to roll tanks was not an option, because it would have meant no more loans, no more grain, and the starvation of the Soviet population.