{"openapi":"3.1.0","info":{"title":"Queue Backlog Horizon","version":"1.0.0","description":"Replay a queue across time windows with arrivals before service and identify remaining backlog and the first fully drained window.","contact":{"email":"jeremy@jeremycarter.ca"}},"servers":[{"url":"https://gptenv-x402-catalog.defcronyke.workers.dev"}],"paths":{"/queue-backlog-horizon/v1/check":{"post":{"operationId":"queue_backlog_horizon","summary":"Replay a queue across time windows with arrivals before service and identify remaining backlog and the first fully drained window.","x-payment-info":{"protocols":[{"x402":{}}],"price":{"mode":"fixed","currency":"USD","amount":"0.04"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"initial_backlog":{"type":"integer","minimum":0,"maximum":1000000000},"windows":{"minItems":1,"maxItems":200,"type":"array","items":{"type":"object","properties":{"duration_seconds":{"type":"integer","minimum":1,"maximum":86400},"arrivals":{"type":"integer","minimum":0,"maximum":1000000000},"service_capacity":{"type":"integer","minimum":0,"maximum":1000000000}},"required":["duration_seconds","arrivals","service_capacity"],"additionalProperties":false}}},"required":["initial_backlog","windows"],"additionalProperties":false},"example":{"initial_backlog":12,"windows":[{"duration_seconds":30,"arrivals":3,"service_capacity":7},{"duration_seconds":20,"arrivals":2,"service_capacity":16},{"duration_seconds":10,"arrivals":5,"service_capacity":2}]}}}},"responses":{"200":{"description":"Service result","content":{"application/json":{"schema":{"type":"object"},"example":{"ending_backlog":3,"peak_backlog":15,"first_drained_at_seconds":50,"windows":[{"end_seconds":30,"served":7,"unused_capacity":0,"ending_backlog":8},{"end_seconds":50,"served":10,"unused_capacity":6,"ending_backlog":0},{"end_seconds":60,"served":2,"unused_capacity":0,"ending_backlog":3}]}}}},"400":{"description":"Invalid request"},"402":{"description":"x402 exact payment required on Base"},"503":{"description":"Payment unavailable"}}}}}}