Start an AI request
Start an AI request (media:write)
Every request sends Authorization: Bearer ...: the access token in local mode, an API key stk_... in cloud mode. Use Send to try it against your cloud instance with your API key.
Queues one AI operation (GET /v1/ai lists the ones this server offers); poll GET /v1/ai/jobs/{id} until it has succeeded, failed or was cancelled. Send the settings before the files. A repeated Idempotency-Key, or the same request from the same person while it still runs, answers 200 with that earlier job instead of starting another. At most 30 requests per 10 minutes and 4 running at once per workspace (429); a request that would pass the workspace's monthly AI limit is refused with 402 ai_limit_reached.
AuthorizationBearer <token>API key (stk_...), or in the Community Edition the access token (stk_local_...)
Idempotency-Key?stringlength <= 200multipart/form-data- body
operation*string"generate""edit""inpaint""erase""expand""remove_background""replace_background""upscale""enhance""text_to_video""image_to_video"prompt?stringRequired or optional as the operation's prompt says; ignored when it is none
length <= 4000width?integergenerate: the picture's width (default 1024, rounded down to a multiple of 16)
256 <= value <= 2048height?integer256 <= value <= 2048duration?integerVideos: seconds (default 5)
510aspect_ratio?stringtext_to_video (default 16:9)
"16:9""9:16""1:1"canvas_width?integerexpand: the new size
64 <= value <= 4096canvas_height?integer64 <= value <= 4096image_x?integerexpand: where the picture sits in the new size
0 <= valueimage_y?integer0 <= valueplace_width?integerexpand: the picture's size there (default its own)
place_height?integerimage?filePNG, JPEG or WebP, at most 20 MB and 4096 px a side (PNG for upscale)
binarymask?fileinpaint, erase: a PNG of the picture's size; white marks the area to change
binaryThe earlier job that answers this request
application/json- response
One AI request
id*stringoperation*stringkind*string"image""video"status*string"queued""running""succeeded""failed""canceled"provider*stringThe provider that runs it; empty until it is sent
model*stringfallback_from*stringThe provider that did not take it first; empty: none
error*null|result*null|media_id*stringThe library file it was kept as; empty until accepted
estimated_cost_usd*numberEstimated from the catalog's list prices; 0 when nothing was charged
duration_ms*integercreated_at*stringdate-timefinished_at*stringEmpty while it runs
curl -X POST 'https://staqly.example.com/v1/ai/jobs' \ -F 'operation=generate'{ "id": "string", "operation": "string", "kind": "image", "status": "queued", "provider": "string", "model": "string", "fallback_from": "string", "error": null, "result": null, "media_id": "string", "estimated_cost_usd": 0, "duration_ms": 0, "created_at": "2019-08-24T14:15:22Z", "finished_at": "string"}