Skip to content

Generating assets

Four commands, one per modality:

Terminal window
layer generate image -p "a crystal sword icon, transparent background"
layer generate video -d 5 --aspect-ratio 16:9 -p "camera pushes through the gate"
layer generate mesh -p "weathered treasure chest, game-ready"
layer generate audio -p "arcade coin pickup"

Each waits for the run, prints what it cost, and writes the result into your working directory.

Leave --base-model off and the CLI asks Layer for the recommended model for that modality, then prints which it chose — the choice is never baked into the package, so a new release of a model reaches you without a CLI upgrade.

Terminal window
layer generate image --base-model bfl-flux-2-pro -p "..."

layer base-models list shows what your workspace can run.

Flag Meaning
-p, --prompt What to generate
-n, --count How many, up to 16
--base-model Which model to run
--seed A repeatable result
--negative What to steer away from
--aspect-ratio Output shape, e.g. 16:9 (image and video)
--resolution Output size, e.g. 2K or 1080p (image and video)
-d, --duration Length in seconds (video and audio)
--reference-set Apply a trained style or reference set; repeatable
--session Group the run under a named session, for browsing in the app
--param key=value A model-specific setting; repeatable
--refresh Ignore the cached model catalogue

A flag the modality does not understand is refused rather than ignored — --duration on an image is an error, not a silently dropped setting, because a discarded flag means a run at settings you believed you had changed.

--param is validated against that model’s own inference schema before the request is sent, so a mistyped key fails immediately instead of producing a default-generated asset. layer base-models show prints the keys a model accepts.

Every run is priced before it executes, and the estimate is printed either way:

Terminal window
layer generate video --confirm -p "..." # ask before spending
layer generate video --max-cost 8 -p "..." # refuse anything more expensive

--max-cost exits 4 when the estimate is over the ceiling, which is the same code you get when the workspace cannot pay for the run at all. See Creative Units.

By default a run blocks and shows progress. To submit and walk away:

Terminal window
id=$(layer --json generate video --no-wait -p "..." | jq -r .inference_id)
layer generate status "$id" --wait

layer generate status <id> prints the state of a run; --wait blocks until it finishes and then downloads, exactly as a foreground run does.

Files land in the working directory under a name derived from the prompt. An existing file is never overwritten — an asset costs Creative Units to produce, so a matching name is numbered rather than replaced. Several outputs from one run are numbered -1, -2, and so on.

Terminal window
layer generate image -p "..." -o props/ # into a directory
layer generate image -p "..." -o hero.png # an exact filename, for a single output
layer generate image -p "..." --no-download # print URLs instead