Skip to main content

See which model answered from the AI Gateway response headers

Shipped by mohamed

When the gateway fails over, the provider’s response body can name a different model than the one you asked for. Three response headers now tell you what happened:

  • Ngrok-AIG-Request-Id is the request’s ID, on every response, including rejections and errors.
  • Ngrok-AIG-Attempts counts the upstream attempts the gateway made.
  • Ngrok-AIG-Model names the upstream model that produced the response.

Browser clients can read all three through CORS. They’re ngrok’s headers, so you get the same values with ngrok credits or your own provider keys. The native Gemini generateContent and streamGenerateContent endpoints return them too.

Get started

  1. Send any request through https://gateway.ngrok.ai.
  2. Read the headers on the response. In the OpenAI SDK, .withResponse() returns them next to the data.
  3. Treat Ngrok-AIG-Model as the answer to “who replied?” See response headers.