I built an API gateway that routes between OpenAI, Anthropic and Gemini. I figured integrating both providers would be the hard part.
It wasn't. Calling their APIs is maybe an afternoon of work each. The hard part showed up later, the first time something went wrong.
The moment it broke
Early on, my error handling was basically: catch whatever the provider throws, forward the status code, move on.
} catch (error) {






