curl --request PATCH \
--url https://api.ngrok.ai/gateway-config \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"totalTimeout": "<string>",
"perRequestTimeout": "<string>",
"maxInputTokens": 123,
"maxOutputTokens": 123,
"metadata": "<string>",
"firewallPolicyId": "<string>",
"expectedFirewallPolicyId": "<string>"
}
'import requests
url = "https://api.ngrok.ai/gateway-config"
payload = {
"totalTimeout": "<string>",
"perRequestTimeout": "<string>",
"maxInputTokens": 123,
"maxOutputTokens": 123,
"metadata": "<string>",
"firewallPolicyId": "<string>",
"expectedFirewallPolicyId": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
totalTimeout: '<string>',
perRequestTimeout: '<string>',
maxInputTokens: 123,
maxOutputTokens: 123,
metadata: '<string>',
firewallPolicyId: '<string>',
expectedFirewallPolicyId: '<string>'
})
};
fetch('https://api.ngrok.ai/gateway-config', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.ngrok.ai/gateway-config",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'totalTimeout' => '<string>',
'perRequestTimeout' => '<string>',
'maxInputTokens' => 123,
'maxOutputTokens' => 123,
'metadata' => '<string>',
'firewallPolicyId' => '<string>',
'expectedFirewallPolicyId' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.ngrok.ai/gateway-config"
payload := strings.NewReader("{\n \"totalTimeout\": \"<string>\",\n \"perRequestTimeout\": \"<string>\",\n \"maxInputTokens\": 123,\n \"maxOutputTokens\": 123,\n \"metadata\": \"<string>\",\n \"firewallPolicyId\": \"<string>\",\n \"expectedFirewallPolicyId\": \"<string>\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.ngrok.ai/gateway-config")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"totalTimeout\": \"<string>\",\n \"perRequestTimeout\": \"<string>\",\n \"maxInputTokens\": 123,\n \"maxOutputTokens\": 123,\n \"metadata\": \"<string>\",\n \"firewallPolicyId\": \"<string>\",\n \"expectedFirewallPolicyId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ngrok.ai/gateway-config")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"totalTimeout\": \"<string>\",\n \"perRequestTimeout\": \"<string>\",\n \"maxInputTokens\": 123,\n \"maxOutputTokens\": 123,\n \"metadata\": \"<string>\",\n \"firewallPolicyId\": \"<string>\",\n \"expectedFirewallPolicyId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"accountId": "<string>",
"uri": "<string>",
"totalTimeout": "<string>",
"perRequestTimeout": "<string>",
"maxInputTokens": 123,
"maxOutputTokens": 123,
"metadata": "<string>",
"firewallPolicyId": "<string>"
}{
"statusCode": 123,
"msg": "<string>",
"details": {},
"errorCode": "<string>"
}Update AI Gateway Configuration
Update the AI Gateway configuration for the authenticated account. Omitted fields preserve their existing stored value.
curl --request PATCH \
--url https://api.ngrok.ai/gateway-config \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"totalTimeout": "<string>",
"perRequestTimeout": "<string>",
"maxInputTokens": 123,
"maxOutputTokens": 123,
"metadata": "<string>",
"firewallPolicyId": "<string>",
"expectedFirewallPolicyId": "<string>"
}
'import requests
url = "https://api.ngrok.ai/gateway-config"
payload = {
"totalTimeout": "<string>",
"perRequestTimeout": "<string>",
"maxInputTokens": 123,
"maxOutputTokens": 123,
"metadata": "<string>",
"firewallPolicyId": "<string>",
"expectedFirewallPolicyId": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
totalTimeout: '<string>',
perRequestTimeout: '<string>',
maxInputTokens: 123,
maxOutputTokens: 123,
metadata: '<string>',
firewallPolicyId: '<string>',
expectedFirewallPolicyId: '<string>'
})
};
fetch('https://api.ngrok.ai/gateway-config', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.ngrok.ai/gateway-config",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'totalTimeout' => '<string>',
'perRequestTimeout' => '<string>',
'maxInputTokens' => 123,
'maxOutputTokens' => 123,
'metadata' => '<string>',
'firewallPolicyId' => '<string>',
'expectedFirewallPolicyId' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.ngrok.ai/gateway-config"
payload := strings.NewReader("{\n \"totalTimeout\": \"<string>\",\n \"perRequestTimeout\": \"<string>\",\n \"maxInputTokens\": 123,\n \"maxOutputTokens\": 123,\n \"metadata\": \"<string>\",\n \"firewallPolicyId\": \"<string>\",\n \"expectedFirewallPolicyId\": \"<string>\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.ngrok.ai/gateway-config")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"totalTimeout\": \"<string>\",\n \"perRequestTimeout\": \"<string>\",\n \"maxInputTokens\": 123,\n \"maxOutputTokens\": 123,\n \"metadata\": \"<string>\",\n \"firewallPolicyId\": \"<string>\",\n \"expectedFirewallPolicyId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ngrok.ai/gateway-config")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"totalTimeout\": \"<string>\",\n \"perRequestTimeout\": \"<string>\",\n \"maxInputTokens\": 123,\n \"maxOutputTokens\": 123,\n \"metadata\": \"<string>\",\n \"firewallPolicyId\": \"<string>\",\n \"expectedFirewallPolicyId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"accountId": "<string>",
"uri": "<string>",
"totalTimeout": "<string>",
"perRequestTimeout": "<string>",
"maxInputTokens": 123,
"maxOutputTokens": 123,
"metadata": "<string>",
"firewallPolicyId": "<string>"
}{
"statusCode": 123,
"msg": "<string>",
"details": {},
"errorCode": "<string>"
}Authorizations
Body
Total timeout duration for a request through the AI Gateway (Go duration string, e.g. 30s, 1m). Defaults to 2m. For a streaming response, the default bounds the stream only until its first byte, after which the stream can run for up to 15 minutes. A value you set applies to the whole stream.
Maximum number of input tokens allowed per request. Must be greater than zero.
PATCH: omit to preserve, send null to clear the cap (no
limit), or send a number to set it. Accounts that have not
written a value read back the per-account default; once
cleared with null, GET returns null until a new value is
written.
Maximum number of output tokens allowed per request. Must be greater than zero.
PATCH: omit to preserve, send null to clear the cap (no
limit), or send a number to set it. Accounts that have not
written a value read back the per-account default; once
cleared with null, GET returns null until a new value is
written.
Response
The updated AI Gateway configuration.
Total timeout duration for a request through the AI Gateway (Go duration string, e.g. 30s, 1m). Defaults to 2m. For a streaming response, the default bounds the stream only until its first byte, after which the stream can run for up to 15 minutes. A value you set applies to the whole stream.
Maximum number of input tokens allowed per request. Must be greater than zero.
PATCH: omit to preserve, send null to clear the cap (no
limit), or send a number to set it. Accounts that have not
written a value read back the per-account default; once
cleared with null, GET returns null until a new value is
written.
Maximum number of output tokens allowed per request. Must be greater than zero.
PATCH: omit to preserve, send null to clear the cap (no
limit), or send a number to set it. Accounts that have not
written a value read back the per-account default; once
cleared with null, GET returns null until a new value is
written.
Was this page helpful?