input; it ends with outputs stored in your library, or with a typed error and a refund.
Lifecycle
succeeded and failed are final: the object never changes again. status_detail is informative and may gain values; branch on status.
Creating
POST /v2/generations does everything that can fail on your side before answering:
- checks the model and mode are enabled for your workspace, and validates
inputagainst the mode’s schema; - resolves the media: assets of your library, elements of your workspace or Argil’s public library, and URLs, imported into your library; it waits up to 60 seconds for files still uploading or processing;
- reserves the credits and queues the generation.
Idempotency-Key: the retry returns the generation already created instead of paying for a second one. To cap what one generation may cost, send max_credits: a generation that would reserve more is refused with 402 credit_limit_exceeded before anything is reserved. URL inputs may already be in your library, since they are imported before the credit and plan checks. A 201 means the generation is queued and will end succeeded or failed.
Its outputs go into the API folder of your library. GET /v2/generations lists your workspace’s generations, newest first: those created through the API, and those made in the Argil app, which have no input, metadata or webhook_url. Only generations created through the API send webhook events.
Waiting for results
Wait in the request — images, scripts, notebooks
Wait in the request — images, scripts, notebooks
Send
Prefer: wait=60 on POST /v2/generations or GET /v2/generations/{id}. The server holds the response until the generation is final or 60 seconds pass, then returns the current object, with Preference-Applied: wait=60. More than 60 reads as 60. Under load (20 waits open in your workspace), the answer comes at once without Preference-Applied: poll as usual. Most images finish within the first call; a ten-minute video takes about ten calls.Webhooks — backends, video
Webhooks — backends, video
Register endpoints once with
POST /v2/webhook_endpoints: each final generation sends them one signed generation.succeeded or generation.failed event carrying the full generation. A webhook_url on the request also receives this generation’s event, unsigned. See Webhooks.Polling — anything else
Polling — anything else
GET /v2/generations/{id} without Prefer returns at once. Until the generation is final, Retry-After says when to poll again. Polling faster does not finish sooner and counts against your rate limit.GET /v2/generations?completed_after=… to catch what your receiver missed during an outage.
Outputs
outputs[] holds one entry per produced file. Each asset is already in your library: Argil stores every output before marking the generation succeeded, so its URL works as soon as you see it.
- Outputs are kept until you delete them, and their URLs do not expire.
- Reuse an output as the input of another generation by its asset id. See Inputs and prompt tags.
Cost
cost follows the credits: estimated is the price of the request, reserved the whole credits held at creation, charged the final price and refunded the difference, both known once the generation is final. Models settled on actual usage charge what they produced; see Credits and pricing.
Failures
A failed generation has anerror with a stable code, a message you can show to your users, and retryable:
A generation that fails before the model produced its output is refunded, and
cost.refunded shows it. output_processing_failed is charged, since the model ran.
Deleting
DELETE /v2/generations/{id} removes a final generation from your history and from your playground. Its output assets stay in your library until you delete them with DELETE /v2/assets/{id}. Deleting a generation still running is 409 generation_not_terminal.
Capacity and queueing
Model capacity is shared across Argil. Generations start by plan priority, then in creation order. Beyond 200 generations waiting in your workspace, creation returns429 too_many_queued_generations. See Rate limits.