This study draws attention to the linkages between country risk and the openness of an economy and demonstrates that in the long run the openness of an economy is endogenously determined by the interaction between endowments and policies. The presence of country risk poses a problem for the smooth operation of international credit markets: the ex-ante first best policy is for countries to pre-commit themselves to no-default policies. Such a commitment, however, may not be credible because it may not be the optimal ex-post policy. This suggests, as a way to increase the credibility of a no-default commitment, a special role for policies leading toward investment in openness. The paper studies the optimal implementation of these policies.