> ## Documentation Index
> Fetch the complete documentation index at: https://ngrok.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Observability Overview

> Monitor and debug AI Gateway requests.

Monitor AI Gateway usage from [app.ngrok.ai](https://app.ngrok.ai) and the AI Gateway API.

<CardGroup cols={2}>
  <Card title="Usage" icon="chart-line" href="/docs/ai-gateway/observability/index#usage-api">
    Query usage events and aggregated overview via the AI Gateway API
  </Card>

  <Card title="Debugging" icon="bug" href="/docs/ai-gateway/guides/debugging">
    Troubleshoot failed requests and error codes
  </Card>

  <Card title="Error Codes" icon="triangle-exclamation" href="/docs/ai-gateway/reference/error-codes">
    Reference for gateway error responses
  </Card>
</CardGroup>

## Identify a request

Every gateway response carries `Ngrok-AIG-Request-Id`, plus `Ngrok-AIG-Attempts` and `Ngrok-AIG-Model` describing 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](/docs/ai-gateway/how-it-works#response-headers).

## Usage API

Query usage with the AI Gateway API:

```bash theme={null}
curl https://api.ngrok.ai/usage/overview \
  -H "Authorization: Bearer $AI_GATEWAY_API_KEY"
```

[List individual usage events](/docs/ai-gateway/api-reference/usage/list) 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.

<Note>
  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.
</Note>

View usage summaries in [app.ngrok.ai](https://app.ngrok.ai) when available.

## Roadmap

* Token usage visualization in app.ngrok.ai
* Cost analytics per access key

**Have feedback?** Email [niji@ngrok.ai](mailto:niji@ngrok.ai) with observability requests.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.