Skip to main content
The Codzen API generates video and images with every Codzen model through one asynchronous API. You submit a generation, then poll it (or receive a webhook) until it finishes.
  • Base URL: https://codzen.ai/api/v1
  • Authentication: Authorization: Bearer cz_…
  • Format: JSON request and response bodies, snake_case fields
1

Create an API key

Sign in to Codzen, open the console and create an API key. Copy it right away: the full key is shown only once.Keep it in an environment variable on your server:
Never put an API key in a browser or mobile app. See Authentication and rate limits.
2

Submit a generation

Send the model’s slug as model and its parameters as input. This example uses codzen-play; the Models index lists every slug and links to each model’s input fields.
The API answers 202 Accepted with the new generation, queued. The estimate is held from your balance:
3

Poll until it finishes

Fetch the generation by its id every few seconds until status is succeeded or failed:
Once it has succeeded, outputs lists what it produced and cost.amount is what it cost:
If it failed, error says why. See Errors.
4

Download the output

Each output’s url downloads without an API key:
The amounts above are examples. See pricing for each model’s prices.

Next steps

Generation lifecycle

The states a generation goes through, and polling versus webhooks.

Webhooks and signatures

Get called when a generation finishes, and verify the call.

Errors

Every error code, and which ones to retry.

API reference

Every endpoint with its request and response shapes.