Skip to main content
Account-wide gateway settings apply to every request through https://gateway.ngrok.ai, so you can set defaults like timeouts and token limits once instead of repeating them on every access key configuration.

Timeouts

If a single attempt exceeds perRequestTimeout, the gateway moves on to the next fallback. If total time exceeds totalTimeout, the gateway returns an error. perRequestTimeout must be less than or equal to totalTimeout.

Streaming responses

Streams use the timeouts differently, so a long completion isn’t cut off:
  • The per-request timeout applies only until the provider sends the first byte. After that, the stream fails if the provider sends nothing for 30 seconds.
  • The default total timeout applies only until the first byte. After that, the stream can run for up to 15 minutes.
  • A totalTimeout you set yourself applies to the whole stream, including the time after the first byte.
If you set totalTimeout, long streaming responses stop when it expires. Leave it unset to keep the 15-minute limit for streams.

Token limits

Leave token limits unset for no cap. Set them to block oversized requests before they reach a provider. Limits must be greater than zero. maxOutputTokens also applies when your request doesn’t set an output limit: the gateway adds one. When your request asks for more, the gateway lowers it to your limit, and to the model’s own maximum.

Request capture

Request capture stores the request and response headers and bodies, including prompts and completions, for your request and each attempt the gateway sends to a provider. You can inspect them on the Logs page. Capture is off by default. To turn it on, open Settings > Data Retention in app.ngrok.ai and set Request Capture to enabled. Captures are kept for 30 days. Credential headers such as Authorization and x-api-key are redacted. Bodies are stored as sent.

Via dashboard

  1. Open Settings in app.ngrok.ai
  2. On General, edit Total timeout, Per-request timeout, and optional token limits
  3. Save
General also shows the gateway URL (https://gateway.ngrok.ai). The other Settings pages are Data Retention for request capture, Admin API Keys for AI Gateway API keys, and Account, which links to dashboard.ngrok.com for your account details and team members.

Via the AI Gateway API

Get current settings:
Update settings (omitted fields keep their current values):
Clear a token limit by sending null:
Duration fields use Go duration strings (for example, 30s, 2m). See the Gateway configuration API reference.

Next steps