$npx -y skills add fal-ai-community/genmedia-cli --skill genmediaRun a fal.ai model end-to-end with the genmedia CLI. Use this when the user asks to generate an image, video, or audio; convert media; upscale or restyle; run any fal.ai model; or "use genmedia" for a task. Guides discovery, schema inspection, input preparation, execution, and re
| 1 | # genmedia workflow |
| 2 | |
| 3 | Use this skill when the user wants to execute a fal.ai model — either by |
| 4 | task description (e.g. "generate a video of a dog running") or by a specific |
| 5 | `endpoint_id` (e.g. `fal-ai/flux/dev`). Load `genmedia-ref` alongside this |
| 6 | skill for the full command reference. |
| 7 | |
| 8 | ## Steps |
| 9 | |
| 10 | 1. **Discover** — If no endpoint_id is given, search for a suitable model: |
| 11 | ``` |
| 12 | genmedia models "<task>" --json |
| 13 | ``` |
| 14 | |
| 15 | 2. **Inspect** — Get the model's input parameters: |
| 16 | ``` |
| 17 | genmedia schema <endpoint_id> --json |
| 18 | ``` |
| 19 | Read all required fields before running. |
| 20 | |
| 21 | 3. **Upload files** (if inputs include images/video/audio): |
| 22 | ``` |
| 23 | genmedia upload <local_file_or_url> --json |
| 24 | ``` |
| 25 | Use the returned `url` as the parameter value. |
| 26 | |
| 27 | 4. **Run** the model: |
| 28 | - Fast model (completes in seconds): |
| 29 | ``` |
| 30 | genmedia run <endpoint_id> --<param> <value> ... --json |
| 31 | ``` |
| 32 | - Slow model (video generation, large jobs): |
| 33 | ``` |
| 34 | genmedia run <endpoint_id> --<param> <value> ... --async --json |
| 35 | genmedia status <endpoint_id> <request_id> --result --json |
| 36 | ``` |
| 37 | |
| 38 | 5. **Save outputs** — when the user expects files on disk, add `--download` |
| 39 | to `run` or `status`. The CLI writes every media URL from the result to |
| 40 | the filesystem and returns the local paths in `downloaded_files[]`. Do |
| 41 | **not** `curl` the URLs yourself; use the flag. |
| 42 | ``` |
| 43 | genmedia run fal-ai/flux/dev --prompt "a cat" --download --json # cwd, source file names |
| 44 | genmedia run fal-ai/flux/dev --prompt "a cat" --num_images 3 --download "./out/{index}.{ext}" --json |
| 45 | genmedia status <endpoint_id> <request_id> --download ./out/ --json # implies --result |
| 46 | ``` |
| 47 | Use `{index}`, `{name}`, `{ext}`, `{request_id}` placeholders in the |
| 48 | template when the model returns multiple files (`images[]`, |
| 49 | `image_urls[]`, etc.) to avoid filename collisions. A trailing `/` or |
| 50 | an existing directory path saves files under that directory using their |
| 51 | source names. |
| 52 | |
| 53 | 6. **Return** the result to the user. If `--download` was used, reference |
| 54 | the paths from `downloaded_files[]`; otherwise present the URLs from |
| 55 | `result` clearly. |
| 56 | |
| 57 | ## Assets library (`genmedia assets ...`) |
| 58 | |
| 59 | The fal Assets API lets you persist generated media, organize it into |
| 60 | collections, and define reusable characters. |
| 61 | |
| 62 | ### Two ways to identify an asset |
| 63 | |
| 64 | - **`vector_id`** — present for any media in the user's library or in a |
| 65 | semantic-search result. Returned by `assets browse` / `assets get` / |
| 66 | `assets upload`. Used both as a flag on mutations and as the positional |
| 67 | argument for `assets get` and `assets tags for-asset`. |
| 68 | - **`request_id`** — the generation the user just ran. Returned by |
| 69 | `genmedia run` and `genmedia status`. |
| 70 | |
| 71 | **Which to pass.** Use `--vector_id` if you have it (anything in the |
| 72 | library or a search result has one); otherwise use `--request_id` for a |
| 73 | fresh generation. |
| 74 | |
| 75 | Use these flags on every command that takes an asset target: |
| 76 | `assets favorite`, `assets unfavorite`, `assets tags assign / unassign / set`, |
| 77 | `assets collections add / remove`, `assets characters create |
| 78 | --reference_image <id>`. |
| 79 | |
| 80 | ### `assets upload` is for external media only |
| 81 | |
| 82 | Use `assets upload` only for **local files or non-fal URLs** — media that |
| 83 | isn't already in fal's system. For anything that came out of a |
| 84 | `genmedia run`, use the `request_id` instead. |
| 85 | |
| 86 | ### Cheatsheet |
| 87 | |
| 88 | | What you have | Use | |
| 89 | |---|---| |
| 90 | | `vector_id` (from `assets browse` / `get` / `upload`) | `--vector_id <id>` | |
| 91 | | `request_id` (from `genmedia run` / `status`) | `--request_id <id>` | |
| 92 | | Local file or non-fal URL | `assets upload <path_or_url>` | |
| 93 | |
| 94 | ### Example — character from a fresh generation |
| 95 | |
| 96 | ```bash |
| 97 | RUN=$(genmedia run fal-ai/flux/schnell --prompt "an elegant black cat" --json) |
| 98 | REQ=$(echo "$RUN" | jq -r .request_id) |
| 99 | |
| 100 | genmedia assets characters create "Whiskers" \ |
| 101 | --description "An elegant black cat sitting on a moss-covered rock" \ |
| 102 | --reference_image "$REQ" \ |
| 103 | --identifier whiskers \ |
| 104 | --json |
| 105 | ``` |
| 106 | |
| 107 | Same pattern for `assets collections add --request_id <id>` and |
| 108 | `assets favorite --request_id <id>`. Newly-referenced media — whether by |
| 109 | `request_id` or by a `vector_id` from a fresh upload — may take a moment |
| 110 | to appear in `assets browse` / semantic search while the embedding |
| 111 | finishes. |
| 112 | |
| 113 | For the full command tree, run `genmedia assets --help` or any subcommand |
| 114 | with `--help`. |
| 115 | |
| 116 | ## Handling errors |
| 117 | |
| 118 | When a command exits non-zero, it prints a JSON error object to stderr: |
| 119 | |
| 120 | ```json |
| 121 | { |
| 122 | "error": "Validation error — num_images: Input should be less than or equal to 4", |
| 123 | "details": { |
| 124 | "endpoint_id": "fal-ai/flux/schnell", |
| 125 | "request_id": "019d...", |