Make an image or video with AI
Paid in the workspace's credits at a fixed price per model. First call with estimate_only: true (free) for the exact price, then again with max_credits set to it. An image is usually done within wait_seconds; a video takes one to five minutes: GET the generation by its id. A failed generation gives its credits back.
POST/v1/sites/{site_id}/media/generations
Requires media:generate, a permission of its own: a credential that can edit sites cannot spend credits unless it was given this one too. Spends the workspace’s credits.
- Call it with
estimate_only: true. It costs nothing and answersestimated_credits(the exact price) andbalance. - Call it again with
max_creditsset to that price. Withoutmax_creditsthe call is refused. A price above it is refused with nothing charged:invalid_parameteronmax_credits, withdetails.reasonprice_above_max_credits,details.estimated_creditsanddetails.max_credits.
The credits are charged when the generation starts. If it fails, they are given back. An image is usually done within wait_seconds (50 by default) and comes back with status: succeeded and its media. A video takes one to five minutes: the answer is status: running with an id; get the generation until it finishes.
The file lands in the site’s media like an upload, with credit set to the model that made it. Never present a generated image as a photograph of the business, its products, its people or its premises.
At most 10 generations a minute per workspace (429 rate_limited above that, with details.retry_after_seconds). Not enough credits: 402 insufficient_credits with details.needed and details.balance. A model that is busy fails the generation with its credits given back: try again in a minute.
Authorizations
Authorizationbearerin headerrequiredPath parameters
site_idstringrequiredThe site's id, or its slug (the address before .atelier201.page).
Body
application/jsonrequiredmodelenum<string>requiredone of: gpt-image, nano-banana, flux, p-image, wan, minimax, seedance, p-videoGET /v1/media/models lists each model, what it is best at and its prices in credits.
promptstringrequiredlength: 1–4000 charsWhat to show: subject, setting, light, framing, style.
aspect_ratioenum<string>one of: 16:9, 1:1, 9:16, 4:3, 3:4, 3:2, 2:3Width to height. Each model accepts the ratios list_media_models gives; default its first (16:9 for most).
qualityenum<string>one of: draft, standard, highImages: draft, standard (default) or high.
durationintegerrange: 1–10Videos: seconds.
resolutionenum<string>one of: 480p, 720p, 768p, 1080p, 2kVideos: default the model's (720p, or 768p for minimax and p-video).
audiobooleanVideos: with sound (seedance only).
filenamestringlength: 1–100 charsA name without extension.
altstringlength: ≤ 300 charsestimate_onlybooleantrue: the exact price in credits and the balance. Free, nothing runs.
max_creditsintegerrange: ≤ 9007199254740991Required to run: the most you agree to spend. Refused, and nothing charged, when the price is higher. Take it from an estimate_only call.
wait_secondsintegerrange: 0–55How long to wait for the result. Default 50 for an image, 0 for a video.
Response
Make an image or video with AI
dataRecord<string, object>requiredrequest_idstringrequiredPossible codes: invalid_request, unknown_field, invalid_parameter, invalid_cursor
errorobjectrequiredrequest_idstringrequiredPossible codes: authentication_required, invalid_api_key, api_key_expired, api_key_revoked
errorobjectrequiredrequest_idstringrequiredPossible codes: insufficient_credits
errorobjectrequiredrequest_idstringrequiredPossible codes: insufficient_scope, feature_not_available, admin_required
errorobjectrequiredrequest_idstringrequiredPossible codes: resource_not_found
errorobjectrequiredrequest_idstringrequiredPossible codes: conflict, result_not_ready, idempotency_key_reused
errorobjectrequiredrequest_idstringrequiredPossible codes: result_expired
errorobjectrequiredrequest_idstringrequiredPossible codes: request_too_large
errorobjectrequiredrequest_idstringrequiredPossible codes: request_too_large_for_plan
errorobjectrequiredrequest_idstringrequiredPossible codes: rate_limited
errorobjectrequiredrequest_idstringrequiredPossible codes: internal_error
errorobjectrequiredrequest_idstringrequiredPossible codes: service_unavailable
errorobjectrequiredrequest_idstringrequired