> ## 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.

# Debug failed requests

> Diagnose AI Gateway request failures on gateway.ngrok.ai.

## gateway.ngrok.ai

When troubleshooting issues with the current AI Gateway at `https://gateway.ngrok.ai`:

1. Check the error code and message in the response body. See [Error Codes](/ai-gateway/reference/error-codes).
2. Verify your app sends an [access key](/ai-gateway/concepts/access-keys)—not an upstream provider key.
3. Confirm the access key's [configuration](/ai-gateway/guides/access-key-configurations) allows the provider and model you requested, with routing credentials attached.
4. Review usage in [Observability](/ai-gateway/observability).

Common fixes:

| Symptom                       | Check                                                                          |
| ----------------------------- | ------------------------------------------------------------------------------ |
| 401 Unauthorized              | Access key missing, malformed, or deleted                                      |
| 403 Forbidden                 | Credits exhausted — [purchase credits](/ai-gateway/concepts/credits)           |
| No API key found (3802)       | Configuration missing routing rule or provider keys for the requested provider |
| Model selection failed (3803) | Model or provider blocked by configuration access scope                        |

See [Error Handling](/ai-gateway/guides/error-handling) for retry and failover behavior.

## Legacy endpoint setup

If you still run the AI Gateway as a Traffic Policy action on a custom ngrok endpoint, action result variables like `${actions.ngrok.ai_gateway}` are available in Traffic Policy expressions. See [Migrating from endpoints](/ai-gateway/guides/migrating-from-endpoints) to move to `gateway.ngrok.ai`.
