Workflow
Token-bucket rate-limit sim API
Replays timestamped requests against a token bucket (capacity + refill rate) and reports which requests were allowed vs throttled and the running token count. Answers 'Would these requests be rate-limited?', 'How many requests pass under this limit?'.
Price$0.03per request
MethodPOST
Route/v1/workflow/token-bucket
StatusLive
MIME typeapplication/json
Rate limit120/minute
Cache0s public
rate-limittoken-bucketthrottlesimulatelimiterquotaburstworkflow
API URL
Integration docshttps://x402.hexl.dev/v1/workflow/token-bucketExample request
{
"capacity": 2,
"refillPerSec": 1,
"requestsAtMs": [
0,
100,
200,
1500
]
}Example response
{
"results": [
{
"atMs": 0,
"allowed": true,
"tokensAfter": 1
},
{
"atMs": 100,
"allowed": true,
"tokensAfter": 0.1
},
{
"atMs": 200,
"allowed": false,
"tokensAfter": 0.2
},
{
"atMs": 1500,
"allowed": true,
"tokensAfter": 0.5
}
],
"allowedCount": 3,
"throttledCount": 1,
"finalTokens": 0.5,
"interpretation": "3/4 requests allowed; 1 throttled."
}Input schema
{
"type": "object",
"required": [
"capacity",
"refillPerSec",
"requestsAtMs"
],
"properties": {
"capacity": {
"type": "number",
"examples": [
2
]
},
"refillPerSec": {
"type": "number",
"examples": [
1
]
},
"requestsAtMs": {
"type": "array",
"items": {
"type": "number"
},
"examples": [
[
0,
100,
200,
1500
]
]
},
"cost": {
"type": "number"
},
"startTokens": {
"type": "number"
}
}
}Output schema
{
"type": "object",
"additionalProperties": true
}