> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fimo.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Media & AI generation

> Upload files, create and transform media with task-based AI commands, and reuse assets across your site.

The media library stores images, videos, and files once so you can reuse them across your site. AI media commands describe the result you want; Fimo chooses the generation route and returns a normal library asset.

## Upload existing files

```bash theme={null}
fimo assets upload ./hero.jpg
fimo assets upload ./hero.jpg --name "Hero image" --parent-id "<folder-uuid>"
```

The JSON response wraps the asset in `data`. Keep `.data.id` when attaching it to a `media` field, or `.data.url` for a direct public URL.

## Generate and transform images

```bash theme={null}
# Create an image
fimo image generate \
  --prompt "editorial illustration of a quiet coastal town at sunrise" \
  --quality standard \
  --aspect-ratio 16:9

# Edit an existing image
fimo image edit \
  --prompt "change the background to a warm sunset" \
  --images <asset-id-or-url> \
  --aspect-ratio 16:9

# Remove a background
fimo image remove-background --image <asset-id-or-url>

# Upscale
fimo image upscale --image <asset-id-or-url> --target-megapixels 8
```

Repeat `--images` when an edit needs multiple references. Run any task with `--help` for the flags and limits supported by your installed CLI.

## Generate and transform video

```bash theme={null}
# Generate from text
fimo video generate \
  --prompt "slow camera push through a greenhouse after rain" \
  --quality standard \
  --duration 6 \
  --aspect-ratio 16:9

# Animate a source image using motion from a video
fimo video animate \
  --video <motion-source-asset-id-or-url> \
  --image <subject-image-asset-id-or-url>

# Replace people while preserving the source motion
fimo video replace \
  --video <source-video-asset-id-or-url> \
  --images <identity-image-asset-id-or-url>
```

To generate from an image, add `--image <asset-id-or-url>` to `fimo video generate`. Add `--loop` to return the final frame to that same image. Loops require an image, use a duration from 3 to 20 seconds, and cannot include generated audio.

## Choose quality

Tasks that support `--quality` accept three stable choices:

| Quality    | Use it for                                         |
| ---------- | -------------------------------------------------- |
| `draft`    | Fast, inexpensive exploration.                     |
| `standard` | Everyday generation and the default.               |
| `premium`  | Final, prominent media where quality matters most. |

Fimo owns the underlying routing. Your commands stay stable as the internal routes improve.

## Preview cost without generating

Add `--dry-run` to validate the task inputs and return a cost estimate without creating an asset or spending credits:

```bash theme={null}
fimo image generate \
  --prompt "a calm beach at sunset" \
  --quality premium \
  --aspect-ratio 16:9 \
  --dry-run \
  --json
```

## Name and organize the result

Every task accepts `--name` and `--parent`:

```bash theme={null}
fimo image generate \
  --prompt "minimal mountain icon, dark ink on transparent background" \
  --name "Mountain icon" \
  --parent <folder-id>
```

The response includes the asset, task, quality when applicable, credits, and USD cost.

When an agent generates an image for a page or content entry, it can store contextual alt text and an optional caption with the asset. Fimo preserves supplied values and uses asset analysis only for metadata that is still missing. An empty alt text is preserved for decorative images.

## Need endpoint-level control?

Task commands are the default. If you explicitly need a media endpoint that is not covered by a task, enable the optional Fal catalog. See [Fal media catalog](/docs/cli/fal-media).

## Browse and open assets

```bash theme={null}
fimo assets list
fimo assets list --image --search "hero"
fimo assets open <asset-id>
fimo assets open <asset-id> --download
fimo assets open <asset-id> --browser
```

Folder management is available through `fimo assets create-folder`, `fimo assets move`, and `fimo assets delete`.

## What's next

<Columns cols={3}>
  <Card title="Content & CMS" icon="database" href="/docs/cli/content">
    Attach media to schema fields.
  </Card>

  <Card title="Framework support" icon="layer-group" href="/docs/cli/frameworks">
    Render media with `<Image>` and `<Video>`.
  </Card>

  <Card title="Media library in Studio" icon="table-cells" href="/docs/studio/media-library">
    Manage media visually.
  </Card>
</Columns>
