Generate media with AI (video, image, or audio)
Generate a new media item from a text prompt: text-to-video, text-to-image, image-to-video, speech, music, or sound effects (generator 'auto' selects the supported model). Async — returns a media id that flips to ready when generation finishes; poll GET /media/:id or register a media.completed webhook. Priced on what the model actually costs; refused with 402 if your balance cannot cover the quote (see GET /me).
API key auth. Prefix cf_live_ for production orgs, cf_test_ for sandbox.
In: header
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
POST /media/generate body.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://example.com/v1/media/generate" \ -H "Content-Type: application/json" \ -d '{ "generator": "text-to-video", "prompt": "string" }'{ "id": "string", "status": "generating", "estimateUsd": 0}{ "error": { "code": "string", "message": "string", "contract": "string", "contractVersion": "string", "details": { "property1": null, "property2": null } }}{ "error": { "code": "string", "message": "string", "contract": "string", "contractVersion": "string", "details": { "property1": null, "property2": null } }}{ "error": { "code": "string", "message": "string", "contract": "string", "contractVersion": "string", "details": { "property1": null, "property2": null } }}{ "error": { "code": "string", "message": "string", "contract": "string", "contractVersion": "string", "details": { "property1": null, "property2": null } }}{ "error": { "code": "string", "message": "string", "contract": "string", "contractVersion": "string", "details": { "property1": null, "property2": null } }}{ "error": { "code": "string", "message": "string", "contract": "string", "contractVersion": "string", "details": { "property1": null, "property2": null } }}{ "error": { "code": "string", "message": "string", "contract": "string", "contractVersion": "string", "details": { "property1": null, "property2": null } }}{ "error": { "code": "string", "message": "string", "contract": "string", "contractVersion": "string", "details": { "property1": null, "property2": null } }}Finalize a direct upload (trigger processing after the bytes are PUT) POST
Confirm the bytes reached the presigned URL and start processing, the step after POST /v1/media. Audio and video move to processing while images complete at once; optionally declare an audio role of vo, music, sfx, or ambience.
Get one committed hosted processing artifact GET
Get download URLs for a run's committed audio or matte artifact on the current source. The URLs last five minutes, so call it right before downloading; it returns 404 until the artifact is committed.