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

SettingDefaultDescription
perRequestTimeout60sMax time for a single upstream attempt
totalTimeout120sMax time for a request including all failover attempts
If a single attempt exceeds perRequestTimeout, the gateway moves to the next failover candidate. If total time exceeds totalTimeout, the gateway returns an error.

Token limits

SettingDefaultDescription
maxInputTokensnoneReject requests above estimated input tokens
maxOutputTokensnoneCap completion length
Leave token limits unset for no cap. Set them to block oversized requests before they reach upstream providers.

Via dashboard

  1. Open Settings in app.ngrok.ai
  2. Edit Total timeout, Per-request timeout, and optional token limits
  3. Save
The Settings page also shows the gateway URL (https://gateway.ngrok.ai) and lets you manage AI Gateway API keys for automation.

Via the AI Gateway API

Get current settings:
curl https://api.ngrok.ai/gateway-config \
  -H "Authorization: Bearer $AI_GATEWAY_API_KEY"
Update settings (omitted fields keep their current values):
curl -X PATCH https://api.ngrok.ai/gateway-config \
  -H "Authorization: Bearer $AI_GATEWAY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "totalTimeout": "120s",
    "perRequestTimeout": "60s",
    "maxInputTokens": 128000,
    "maxOutputTokens": 8192
  }'
Clear a token limit by sending null:
curl -X PATCH https://api.ngrok.ai/gateway-config \
  -H "Authorization: Bearer $AI_GATEWAY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "maxInputTokens": null }'
Duration fields use Go duration strings (for example, 30s, 2m). See the Gateway configuration API reference.

Next steps