Rate limit dimensions
Dimension keys determine how the gateway groups traffic into rate limit buckets. Each dimension key references a value from the request context. The gateway resolves these values at runtime to find the matching rate limit entry.
Supported dimensions
| Dimension key | Description | Example value |
|---|---|---|
|
|
The name of the target being invoked. Resolved from the request path. |
|
|
|
The fully-qualified name of the tool being invoked, in the format |
|
|
|
The fully qualified model identifier for inference targets. |
|
|
|
A claim extracted from the caller’s JWT token. Replace |
|
|
|
The IAM principal ARN of the caller. |
|
|
|
The source identity set by the caller when assuming a role. |
|
The default value (*)
Rate limit entries support the special value * as a catch-all default for a dimension.
-
An entry with
*for a dimension means "apply this rate to all values of this dimension." -
If a more specific entry exists for the actual value, the specific entry takes precedence (most-specific match wins).
-
*creates independent per-entity buckets — each distinct value that matches gets its own rate bucket at the configured rate.
Trailing-only constraint for multi-dimension rate limits:
When a rate limit has multiple dimension keys,
can only appear in trailing positions. If you use at position N, all subsequent positions must also be *.
For example, with dimensionKeys: ["targetName", "toolName", "$.context.jwt.sub"]:
| Entry dimensions | Valid | Why |
|---|---|---|
|
|
Yes |
All positions are specific values. |
|
|
Yes |
Only the last position is |
|
|
Yes |
Trailing positions are |
|
|
Yes |
All positions are |
|
|
No |
|
|
|
No |
|
|
|
No |
|
How matching works:
When a request arrives, the gateway resolves the actual dimension values and looks for the most specific matching entry. For example, if the resolved values are ["target1", "readData", "alice"], the gateway checks entries in this order:
-
["target1", "readData", "alice"]— exact match (most specific) -
["target1", "readData", "*"]— last dimension uses default -
["target1", "*", "*"]— last two dimensions use default -
["*", "*", "*"]— fully default (least specific)
The first match wins.
Tip
Use specific entries for known high-value or restricted entities, and * entries as default rate tiers for everything else.
Dimension resolution behavior
When the gateway evaluates a rate limit, it resolves each dimension key from the request context:
-
If a dimension key cannot be resolved from the request (for example,
toolNameon a non-tool request, or a JWT claim that does not exist), the gateway skips that rate limit entirely. The request is not throttled by that rate limit. -
Only validated context is used for resolution. JWT claims are extracted from tokens that have been validated by the gateway’s authentication configuration. IAM context is available only for SigV4-authenticated requests.
Shared vs individual limits
The combination of dimension keys and entry values determines whether traffic shares a single rate bucket or each entity gets its own independent bucket.
| dimensionKeys | Entry dimensions | Behavior |
|---|---|---|
|
|
|
All traffic to |
|
|
|
Each target gets its own independent bucket at this rate (per-entity). |
|
|
|
Each unique caller gets their own bucket (individual per-caller limit). |
|
|
|
Each caller gets their own bucket, scoped to |
|
|
|
Each unique target-and-caller combination gets its own bucket. |
Warning
Avoid using high-cardinality or unbounded JWT claims as dimension keys (for example, $.context.jwt.jti, $.context.jwt.nonce, or request IDs). These create an unbounded number of rate buckets, which might reduce the effectiveness of rate limiting. Use stable, bounded identifiers such as sub, team, or tier instead.