Skip to main content
Monitor AI Gateway usage from app.ngrok.ai and the AI Gateway API.

Usage

Query usage events and aggregated overview via the AI Gateway API

Debugging

Troubleshoot failed requests and error codes

Error Codes

Reference for gateway error responses

Identify a request

Every gateway response carries Ngrok-AIG-Request-Id, plus headers such as Ngrok-AIG-Attempts, Ngrok-AIG-Model, Ngrok-AIG-Rejected-Models, and Ngrok-AIG-Removed-Params that describe how the request was served. Record the request ID in your application logs so you can tie a client-side failure to gateway usage data later. See Response headers.

Usage API

Query usage with the AI Gateway API:
The overview returns daily cost, request, and error series for the window. startTime is required. Group by provider (the default) or accessKey. List individual usage events to see one record per upstream attempt. Each event reports the provider, model, status code, token counts, and a per-attempt cost breakdown. Attempts of the same client request share a requestId. By default the list returns only each request’s terminal attempt. Pass includeRetries=true to see the retries the gateway made along the way.
When a provider reports no usage of its own, usageEstimated is true and the provider-reported token fields are all zero. Read inputTokensEstimate and outputTokensEstimate on those attempts instead.

Look up one request

To see every attempt the gateway made for one request, pass its Ngrok-AIG-Request-Id to GET /usage/requests/{requestId}. See Why a request failed over.

Logs in app.ngrok.ai

The Logs page in app.ngrok.ai lists recent requests. Open a request to see its attempts. If you turn on request capture, the request detail also shows the captured headers and bodies. Have feedback? Email niji@ngrok.ai with observability requests.