# Generating assets

Four commands, one per modality:

```bash
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.

## Choosing a model

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.

```bash
layer generate image --base-model bfl-flux-2-pro -p "..."
```

[layer base-models list](/docs/cli/base-models) shows what your workspace can run.

## Flags

| 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](/docs/cli/base-models) prints the keys a model accepts.

## Cost

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

```bash
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](/docs/creative-units).

## Long runs

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

```bash
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.

## Output

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.

```bash
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
```

Note

Generation is rate limited to 60 requests per minute per user, plus 30 per minute for video. See [rate limits](/docs/rate-limits).
