input, and the model produces one or more outputs. Every generation is asynchronous. POST /generations returns at once with 202 Accepted and the generation, queued; the model then works in the background.
States
succeeded and failed are terminal: once a generation reaches one, its status, outputs and cost never change. completed_at is set at the same time.
A generation fails for any reason it cannot finish: the model rejected the content, the model was unavailable or failed, it timed out, or something went wrong on Codzen’s side. The error.code tells them apart; see Errors.
Learn when it finishes
Pick one of two ways:- Poll
GET /generations/{id}untilstatusissucceededorfailed. This is the simplest choice and needs no public endpoint. Poll every few seconds: a generation usually takes from seconds to minutes, depending on the model and its input. Each poll counts toward your rate limit. - Webhook: pass
webhook_urlwhen you create the generation, and Codzen sends you the finished generation once it reaches a terminal state. See Webhooks and signatures.
Inputs
The fields ofinput depend on the model; each model’s page lists them, linked from the Models index. Unknown fields are rejected with 400 invalid_request, and error.param names the field.
Fields that take an input asset, such as an image or video to start from, end in _url. An image can be an HTTPS URL or a data URI of at most 10 MB; video and audio must be HTTPS URLs. Codzen downloads each input asset when you submit, and rejects the generation with 400 invalid_request if it cannot be downloaded or is not a supported format or size.
The generation’s input is returned normalized: input assets point at Codzen’s copies, and other fields are as you sent them.
Outputs
outputs is always an array, empty until the generation succeeds. Each item has a type (video, image, audio or 3d) and a url.
Anyone who has an output URL can download it, without an API key. The URLs are hard to guess but not secret, so share them with care.
List your generations
GET /generations returns your generations, newest first. It takes:
The response is
{ "data": [...], "has_more": true }. While has_more is true, pass the last id in data as after to get the next page:
404 generation_not_found.
