Skip to main content

Traffic Policy Unit (TPU) Pricing

Traffic Processing Units (TPUs) are ngrok's usage-based metric for measuring the work your traffic policies perform. Because requests can include any mix of expressions, macros, and actions—often applied only to a subset of traffic—charging a flat rate per request or connection would usually result in overcharging. Instead, ngrok calculates TPUs dynamically for each request, based only on the parts of the traffic policy that were actually executed.

TPUs are sold in bundles of 100,000 for $1 and are charged as your policies execute.

TPU pricing breakdown

  • Actions: Define what happens when a traffic policy rule matches (such as adding headers, denying a request, or forwarding traffic).
  • Macros: Macros can be used within the Traffic Policy engine to simplify traffic management and dynamic configuration.
  • Variables: Metadata about connections or requests that you can use in expressions or actions (such as the client IP or headers).

Actions

NameTPU Cost
add-headersFree
basic-authFree
circuit-breaker10 TPUs
compress-response10 TPUs
custom-responseFree
denyFree
forward-internalFree
forward-external10 TPUs
http-request1 TPU
jwt-validation10 TPUs
logFree
oauthFree
oidcFree
owasp-crs-request10 TPUs
owasp-crs-response10 TPUs
rate-limit1 TPU
redirect10 TPUs
remove-headers1 TPU
restrict-ips10 TPUs
samlFree
set-varsFree
terminate-tls100 TPUs
url-rewrite10 TPUs
verify-webhook1 TPU

Macros

NameTPU Cost
b64.decode(string)3 TPUs per GB after 1 GB
b64.encode(string)3 TPUs per GB after 1 GB
basic_auth.encode(username, password)Free
http.header(name)Free
http.header(name, default)Free
http.param(name)Free
http.param(name, default)Free
http.path()Free
http.path_segment(index)Free
http.path_segment(index, default)Free
http.query()Free
http.query_param(name)Free
http.query_param(name, default)Free
http.remote_addr()Free
http.request_body()Free
http.request_body_json()Free
http.request_body_query()Free
http.request_method()Free
http.request_uri()Free
http.response_body()Free
http.response_body_json()Free
http.response_body_query()Free
http.scheme()Free
http.status()Free
http.status_text()Free
http.user_agent()Free
inCidrRange(ip, cidr)Free
inCidrRanges(ip, cidrs)Free
json.decode(string)3 TPUs per GB after 1 GB
json.encode(list| map)3 TPUs per GB after 1 GB
list.encodeJson()Free
object.encodeJson()Free
object.encodeQueryString()Free
queryString.decode(string)Free
queryString.encode(map)Free
rand.double()Free
rand.int(min, max)Free
security.secret(string, string)Free
string.decodeBase64()Free
string.decodeJson()Free
string.decodeQueryString()Free
string.encodeBase64()Free
string.escapeUrl()Free
string.isJson()Free
string.isQueryString()Free
string.isURL()Free
string.parseUrl()Free
string.unescapeUrl()Free
url.escape(string)Free
url.parse(string)Free
url.unescape(string)Free
utility.base64_decode(string)Free
utility.base64_encode(string)Free
utility.basic_auth_encode(username, password)Free
utility.in_cidr_range(ip, cidr)Free
utility.in_cidr_ranges(ip, cidrs)Free
utility.json_decode(string)Free
utility.json_encode(list | map)Free
utility.list_encode_json()Free
utility.object_encode_json()Free
utility.object_encode_query_string()Free
utility.query_string_decode(string)Free
utility.query_string_encode(map)Free
utility.rand_double()Free
utility.rand_int(min, max)Free
utility.string_decode_base64()Free
utility.string_decode_json()Free
utility.string_decode_query_string()Free
utility.string_encode_base64()Free
utility.string_escape_url()Free
utility.string_is_json()Free
utility.string_is_query_string()Free
utility.string_is_url()Free
utility.string_parse_url()Free
utility.string_unescape_url()Free
utility.url_escape(string)Free
utility.url_parse(string)Free
utility.url_unescape(string)Free

Variables

NameTPU Cost
actions.ngrok.add_headers.headers_addedFree
actions.ngrok.basic_auth.credentials.presentedFree
actions.ngrok.basic_auth.credentials.usernameFree
actions.ngrok.basic_auth.credentials.authorizedFree
actions.ngrok.compress.already_compressedFree
actions.ngrok.compress.negotiated_algorithmFree
actions.ngrok.http_request.error.codeFree
actions.ngrok.http_request.error.messageFree
actions.ngrok.http_request.attemptsFree
actions.ngrok.http_request.reqFree
actions.ngrok.http_request.resFree
actions.ngrok.jwt_validation.tokensFree
actions.ngrok.jwt_validation.error.codeFree
actions.ngrok.jwt_validation.error.messageFree
actions.ngrok.log.metadataFree
actions.ngrok.oauth.error.codeFree
actions.ngrok.oauth.error.messageFree
actions.ngrok.oauth.identity.idFree
actions.ngrok.oauth.identity.emailFree
actions.ngrok.oauth.identity.nameFree
actions.ngrok.oauth.identity.provider_user_idFree
actions.ngrok.oauth.identity.current_provider_session_idFree
actions.ngrok.oauth.access_tokenFree
actions.ngrok.oauth.refresh_tokenFree
actions.ngrok.oauth.expires_atFree
actions.ngrok.oauth.session_timed_outFree
actions.ngrok.oauth.session_max_duration_reachedFree
actions.ngrok.oidc.error.codeFree
actions.ngrok.oidc.error.messageFree
actions.ngrok.oidc.identity.idFree
actions.ngrok.oidc.identity.emailFree
actions.ngrok.oidc.identity.nameFree
actions.ngrok.oidc.identity.provider_user_idFree
actions.ngrok.oidc.identity.current_session_idFree
actions.ngrok.oidc.identity_tokenFree
actions.ngrok.oidc.access_tokenFree
actions.ngrok.oidc.refresh_tokenFree
actions.ngrok.oidc.expires_atFree
actions.ngrok.oidc.session_timed_outFree
actions.ngrok.oidc.session_max_duration_reachedFree
actions.ngrok.oidc.userinfo_refreshedFree
actions.ngrok.rate_limit.bucket_keyFree
actions.ngrok.rate_limit.limitedFree
actions.ngrok.rate_limit.error.codeFree
actions.ngrok.rate_limit.error.messageFree
actions.ngrok.redirect.matchesFree
actions.ngrok.redirect.urlFree
actions.ngrok.redirect.error.codeFree
actions.ngrok.redirect.error.messageFree
actions.ngrok.remove_headers.headers_removedFree
actions.ngrok.restrict_ips.actionFree
actions.ngrok.restrict_ips.matched_cidrFree
actions.ngrok.restrict_ips.error.codeFree
actions.ngrok.restrict_ips.error.messageFree
actions.ngrok.url_rewrite.matchesFree
actions.ngrok.url_rewrite.urlFree
actions.ngrok.url_rewrite.error.codeFree
actions.ngrok.url_rewrite.error.messageFree
actions.ngrok.verify_webhook.verifiedFree
conn.bytes_inFree
conn.bytes_outFree
conn.client_ipFree
conn.client_portFree
conn.server_ipFree
conn.server_portFree
conn.server_regionFree
conn.ts.startFree

Traffic Policy Unit (TPU) discounts at scale

The Pay-as-you-go plan provides discounts on TPUs for large scale deployments so you always get the best price as you grow. Discounted pricing is as follows:

CountTPU Cost
0+$1/100k
1M+$.75/100k
10M+$.55/100k
100M+$0.35/100k
1B+$0.25/100k