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

# Media and AI generation

> Upload files, organize the media library, and generate images or videos from the CLI.

Upload media once, then reuse it in content, pages, and AI chat. Files created by Fimo's generation commands land in the same media library.

## Upload and find files

```bash theme={null}
fimo assets upload ./hero.jpg --name "Homepage hero"
fimo assets list --image --search "hero"
fimo assets list --image --cursor <next-cursor>
fimo assets list --image --all-pages
fimo assets open <asset-id>
```

The upload response includes the asset ID and URL. Store media fields as `{ source: 'local', url, alt }` with that URL. Do not copy the asset's ID, name, MIME type, width, or height into the field.

Name the media field in `populate` before passing it to an image component:

```bash theme={null}
fimo entries list BlogPost --limit 1 --populate cover --json
fimo entries get BlogPost <id> --populate cover --json
```

For media inside blocks, name the top-level blocks field to populate every media value inside it.

Generated clients accept the same field name, for example `BlogPost.getBySlug('hello', { populate: ['cover'] as const })`. Verify the returned intrinsic width and height, pass the whole value to `<Image>`, and check the optimized responsive `srcset` at desktop and mobile widths.

With optimization enabled on an eligible Fimo URL, `sizes` set, and no custom `srcSet`, generated width candidates stop at the intrinsic width. Your component props and CSS still choose the displayed size and crop.

Asset lists return `nextCursor` when another page exists. Keep the same filters when continuing a query. The older `--offset` flag remains accepted for existing scripts.

You can also create folders, move assets, and remove them:

```bash theme={null}
fimo assets create-folder "Campaign"
fimo assets move <asset-id> --parent-id <folder-id>
fimo assets remove <asset-id>
```

## Keep images out of the repository

`fimo validate`, which `fimo deploy` runs first, warns when image or video files (`.png`, `.jpg`, `.jpeg`, `.webp`, `.gif`, `.avif`, `.mp4`, `.webm`, `.mov`) would be committed with your code:

```text theme={null}
⚠ 2 image or video files are committed to the repo instead of the Media Library:
  public/hero.png, src/assets/team.jpg. Upload each with `fimo assets upload <file>`
  (or a batch with `fimo assets bulk-upload --file <manifest.json>`), use the
  returned asset URL in code, and delete the repo copy.
```

Upload each file, replace its path in your code with the returned URL, then delete the file from the repository. Library images get responsive optimization through `<Image>`, and your team can find, reuse, and replace them in Studio. The agent skills that ship with the CLI tell coding agents to upload local images and videos with `fimo assets upload` instead of committing them.

The warning does not block validation or deploys. It skips files git ignores, build output, SVGs, and files that browsers or frameworks must read from the repository: favicons, `apple-touch-icon` and app icons, and framework metadata images such as `opengraph-image` and `twitter-image`. With `--json`, the warning is in `warnings[]` as text and in `data.warnings[]` with the code `media/committed-to-repo` and the list of `files`.

## Let agents read existing assets

When an agent needs to understand a document or media file, it can read the
supported interpretation already associated with a Media Library asset:

```bash theme={null}
fimo assets read <asset-id>
fimo assets read <asset-id> --cursor <next-cursor>
fimo assets read <asset-id> --query "What are the important details?"
```

The result is bounded. Follow `nextCursor` until `complete` is `true` for a
complete read, or use `--query` for one targeted question. Use
`fimo assets open <asset-id> --download` when the agent needs the original
file instead of its canonical interpretation. Archives are downloaded and
inspected in the agent's sandbox rather than extracted on the server.

### Supported file types

Asset reading covers these common file types:

* Images: `.png`, `.jpg`, `.jpeg`, `.webp`, `.avif`
* Documents and data: `.pdf`, `.doc`, `.docx`, `.xls`, `.xlsx`, `.ppt`,
  `.pptx`, `.epub`, `.odt`, `.ods`, `.odp`, `.rtf`, `.html`, `.htm`, `.csv`,
  `.md`, `.markdown`, `.json`, `.txt`
* Archives: `.zip`
* Audio: `.mp3`, `.wav`, `.aiff`, `.aif`, `.aac`, `.ogg`, `.flac`
* Video: `.mp4`, `.mpeg`, `.mpg`, `.mov`, `.avi`, `.flv`, `.webm`, `.wmv`,
  `.3gp`
* 3D models: `.glb`, `.gltf`, `.fbx`, `.obj`, `.stl`, `.ply`

Chat model input support can vary. If a model cannot accept a direct
attachment, use a model that supports the format or read the stored asset
interpretation with `fimo assets read`.

### Size limits

No single file may exceed 50 MiB, wherever it is uploaded from — the CLI, the
Media Library, or a chat attachment.

Chat attachments are held to a tighter limit per file type, because the whole
message has to fit in one turn:

| Attachment | Limit per file |
| - | - |
| Documents and data | 5 MiB |
| Audio | 10 MiB |
| Images | 20 MiB |
| Video | 20 MiB |
| ZIP archives | 20 MiB |
| 3D models | 20 MiB |

One message carries at most 10 attachments totalling 20 MiB. A file over any of
these limits is refused before it is uploaded, and Fimo names the file, its
size, and the limit it missed.

A site's total stored media is a separate, plan-based allowance. Reaching it
refuses new uploads with the figures involved, whatever each file's size.

## Generate an image

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

Image commands can also edit an existing image, remove its background, or upscale it. Run the task with `--help` to see the inputs supported by your installed CLI.

To make a new image that matches the ones you already have, pass them as references. Agents do this when they make an image for a content field:

```bash theme={null}
fimo image edit \
  --prompt "a new cover in exactly the style of these images: a lighthouse at night" \
  --images <asset-id-or-url> \
  --images <asset-id-or-url> \
  --aspect-ratio 16:9
```

Preview a generation request without creating an asset:

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

## Generate a video

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

Add `--image <asset-id-or-url>` to start from an image. Other video tasks can animate an image from source motion or replace people while keeping the source motion.

## Choose a quality

| Quality | Use |
| - | - |
| `draft` | Fast exploration |
| `standard` | Everyday generation and the default |
| `premium` | Final media where detail matters |

## Replace or remove assets safely

Check where an asset is referenced before you remove it:

```bash theme={null}
fimo assets usage <asset-id> --json
```

The scan covers the Current Branch, Main, and Live, and reports coverage and a reference count for each. Other Branches and code references are not checked, so use the result as guidance for those three places only.

```bash theme={null}
# Point Current Branch references at another asset; keep the source asset
fimo assets replace <source-id> --with <replacement-id>

# Scan for guidance, then remove from the Current Branch
fimo assets remove <asset-id>

# Replace Current Branch content references first, then remove
fimo assets remove <source-id> --replace-with <replacement-id>
```

`fimo assets remove <asset-id>` removes the asset from the current Branch. It does not replace references automatically. Reference counts and incomplete scan results do not block it. Main, Live, other Branches, and the stored file remain unchanged.

`fimo assets remove <asset-id> --permanent` deletes the asset from the site and cannot be undone. The command asks for confirmation. Pass `--yes` only for an already-approved non-interactive run:

```bash theme={null}
fimo assets remove <asset-id> --permanent
fimo assets remove <source-id> --replace-with <replacement-id> --permanent
fimo assets remove <asset-id> --permanent --yes
```

With both `--replace-with` and `--permanent`, Fimo first updates known content references in every active Branch and Live, then deletes the source file. If a replacement fails, Fimo keeps the source file so the command is safe to retry.

`fimo assets delete` remains an alias for `fimo assets remove` for existing scripts.

For every media task, option, and supported limit, see the [CLI reference](/docs/reference/cli.md).

## What's next

> [card] [Media library](/docs/studio/media-library.md)
>
> Upload, sort, and reuse files in Studio.

> [card] [Content](/docs/cli/content.md)
>
> Attach assets to content fields.

> [card] [Frameworks](/docs/cli/frameworks.md)
>
> Render media with the right adapter.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.