Skip the polling loop: a wait budget on createTask, plus account-level webhook endpoints
Two ways to stop writing polling loops. Both are live.
A wait budget on task creation. Append ?wait=<seconds> to createTask and we hold the connection open until the task reaches a terminal state, answering with the full task record — the same shape recordInfo returns.
- Budget runs out: you get the ordinary
202, identical to omitting it, and poll from there. - You disconnect: nothing changes for the task. It keeps running and bills as usual.
- The ceiling is 60 seconds. Larger values are clamped rather than rejected, and a malformed value is ignored rather than rejected — a typo in an optimisation parameter should not fail a generation that would otherwise succeed.
Use it on endpoints that finish in seconds, which is most image and edit work. Video models routinely run for minutes, so it will simply time out and you end up polling anyway.
Account-level webhook endpoints. Register a URL once together with the events it wants, and every matching task is delivered to it — you never pass a callback URL on a task again. An account holds up to 16 endpoints, each with its own signing secret. A 410 Gone from your server disables that endpoint immediately rather than retrying an address whose owner has retired it. Endpoints are API-only for now; the console has no screen for them yet.