5AM CLI Reference

Command-line tool for the 5AM Media Hub, optimized for AI agents and creative automation.

Runnable examples on GitHub

Copy-and-adapt scripts for the workflows below — a systemd installer for server agents, a podcast → video renderer, a metrics sampler, and SKILL.md, a full CLI reference written for AI agents. Apache-2.0.

Install

macOS & Linux (One-liner script)

The easiest way to install or upgrade the 5am CLI on macOS (Apple Silicon & Intel) and Linux (x86_64 & ARM64) is using our installation script:

sh
curl -fsSL https://cli.5am.app/cli/latest/install.sh | sh

The script installs to /usr/local/bin, asking for sudo when that folder is not writable. To install without sudo, choose a folder you own (and add it to your PATH if it is not there):

sh
curl -fsSL https://cli.5am.app/cli/latest/install.sh | FIVEAM_INSTALL_DIR="$HOME/.local/bin" sh

Windows (PowerShell)

powershell
Invoke-WebRequest https://cli.5am.app/cli/latest/5am-windows-amd64.exe -OutFile 5am.exe
./5am.exe --version

Verify integrity against the published .sha256:

sh
curl -L https://cli.5am.app/cli/latest/5am-darwin-arm64.sha256
shasum -a 256 5am

Self-update

Once installed, the CLI keeps itself current:

sh
5am update                  # download + install the latest release in place
5am update --check          # just print whether a newer version is available
5am update --runtime-only   # install the matching runtime

5am update fetches and verifies the latest binary and replaces the executable atomically. Core installation and updates require neither Node, Chrome, nor the image-edit runtime. If you have opted into a managed image-edit runtime, updates keep it synchronized with the CLI.

Image editing is optional: run 5am update --runtime-only to install the matching runtime, locked JS dependencies, and Skia (@napi-rs/canvas 1.0.11) via Node's npm. The runtime goes beside the 5am binary, so the command needs to write that folder: if you installed the CLI with sudo, run it with sudo too, or reinstall with FIVEAM_INSTALL_DIR="$HOME/.local/bin" and no sudo is needed for either. From CLI v1.8.9, it tells you so when it cannot write the folder. Execution, rendering, and input-bound inspection require Node.js 20+ and run on Native Skia (skia) by default without a browser; installed Chrome/Chromium is only required when --engine chrome (FIVEAM_IEDL_ENGINE=chrome) is selected. CLI v1.6.2 and earlier render with Chrome instead. See IEDL setup.

Getting Started

Authentication

Mint a personal access token in the web UI at Settings → CLI Access Tokens by clicking Generate token. Pick scopes (read, write, admin) and copy the token.

sh
5am login                  # paste token at the prompt
5am login --token <TOKEN>  # or pass directly
5am whoami                 # verify
5am doctor --pretty        # from CLI v1.8.6: what is ready on this computer (ffmpeg, login, Node, runtime)

From CLI v1.8.95, 5am login without --token first prints where to make a token (https://5am.app/settings?utm_source=cli&utm_medium=login_handoff#keys), and a command refused for a missing scope names the same page. The two labels in that address tell 5AM the visit came from the CLI; a new account made there keeps them as where it came from.

Alternatively, pass it in an environment variable: FIVEAM_TOKEN=<TOKEN> 5am whoami (CLI v1.8.0 and later). A shell cannot set the older 5AM_TOKEN name, since it starts with a digit; see the FAQ.

You don't need to sign in to try video edits: they run on your computer with your own ffmpeg, and a render while you are signed out is a free draft with the 5AM mark. From CLI v1.8.6, 5am media edit sample writes a sample edit and a test video to try it on (see VEDL).

Tab Completion

The CLI ships completion scripts for bash, zsh, fish, and PowerShell. Once installed, <tab> expands commands, flags, and options.

sh
# zsh
mkdir -p ~/.zsh/completions
5am completion zsh > ~/.zsh/completions/_5am

# Add to ~/.zshrc (before `compinit` runs):
#   fpath=(~/.zsh/completions $fpath)
exec zsh

Image Editing

Generate reusable IEDL recipes, validate them, and render through the same engine as the web editor:

sh
5am update --runtime-only
5am media image-edit generate --brief "Warm portrait, gentle contrast, 4:5 crop. Local adjustments only; no AI selections or generative edits." -o portrait.iedl
5am media image-edit validate portrait.iedl
5am media image-edit render portrait.iedl --input photo.jpg -o edited.jpg --resolved edited.iedl-resolved.json --bundle edited.iedl.zip

Recipe generation uses the CLI's normal Gemini access flow and model quota. Local rendering does not upload the result. Remote selections and masked AI edits require an authenticated library source via --media-id instead of --input.

Apply a local-only recipe to a directory of PNG, JPEG, or WebP images:

sh
5am media image-edit batch portrait.iedl --input-dir photos --output-dir edited --report batch.json
# Alternatively, start the batch with lower concurrency:
5am media image-edit batch portrait.iedl --input-dir photos --output-dir edited --concurrency 1 --report batch.json

Batch rendering processes up to four images at a time in isolated Node worker threads on Native Skia (skia) by default (or shares one Chrome browser across isolated browser contexts when --engine chrome is selected). Set --concurrency from 1 to 4 to control memory and CPU use. The input directory is nonrecursive, and batch mode cannot use --media-id.

--timeout remains a per-image deadline (default 2m). A failed or timed-out image is recorded while the remaining images continue. The report preserves input filename order and includes the concurrency and failure count; the command exits nonzero if any image fails. Ctrl-C stops the batch and cleans up worker threads, any rollback browser, and temporary files. Update the CLI and its optional runtime together to use the new batch behavior.

The IEDL language reference covers all operations, parameters, masks, presets, local analysis, resolved bundles, batch rendering, and the focused IEDL skill for LLM recipe authoring. Workflow Python delegates recipe creation to this CLI command; it does not need the full language specification.

Commands

Account

sh
5am account                                # storage usage, plan, subscription
5am account --pretty                       # human-readable summary

AI Credits

Every Gemini feature in the CLI (image, video, music and speech generation, transcription, --describe, smart crop, clips, highlight reels, collage music and 5am motion) runs on your account's AI credits, so you don't need a Gemini key. Your plan includes an allowance of credits, renewed monthly on paid plans, and credits you buy never expire.

sh
5am credits                                          # balance, how the CLI reaches Gemini, and the packs on sale
5am credits buy                                      # a payment link for the smallest pack; opens in your browser, then waits
5am credits buy --pack ai_pack_20                    # another pack, by id or by credits (--pack 20000)
5am credits buy --pack ai_pack_5 --no-wait           # print the link and return at once (agents and scripts)
5am credits wait --since <purchased_total_micros>    # wait for that purchase to arrive
# From CLI v1.8.0:
5am credits buy --no-wait --reason 'To export your edit: 50 credits' --valid-for 24h
5am credits wait --link <id>                         # follow that link: added, review, expired...
5am credits buy --pack ai_pack_5 --spt <spt_token>   # pay with a Link token instead of a link
5am credits buy --ask-owner --reason 'Weekly reels'  # ask the account owner (5AM Comms chat)
5am credits wait --request <id>                      # wait for the owner's answer
# From CLI v1.8.8:
5am credits history                                  # where credits went: the ledger, newest first, grouped by request
5am credits history --all                            # every page (--limit and --cursor for one)

Payment links. 5am credits buy makes a link (https://5am.app/pay#…) that opens on any device, your phone included. Whoever opens it pays with a card without signing in. The link lasts 30 minutes, the credits always go to the account the CLI is logged in to, and nothing is charged until someone pays on that page. From CLI v1.8.0, --reason (up to 140 characters, in single quotes so the shell leaves a $ alone) shows on the page, --valid-for keeps the link up to 24 hours for someone who reads the message later, and 5am credits wait --link <id> follows that link and says how it ended.

  • buy waits until the credits arrive; Ctrl-C stops the waiting, not a payment. With --no-wait it prints {"status":"awaiting_payment","url":…,"purchased_total_micros":…} and returns. Pass that number to 5am credits wait --since to wait later (35 minutes by default, --timeout to change it). Don't run buy again to wait: that makes a second link.
  • An agent should tell the person which pack and price, get a yes, and send them the link. It should never open or pay the link itself.
  • Buying credits, and spending them, needs a token with write scope. A read-only token cannot spend credits; use your own key with it, or create a token with write scope.

Paying with a Link token (from CLI v1.8.0). An agent connected to the person's Link wallet for agents pays without a link: 5am credits prints the steps in agent_payments.how (a spend request for the pack, approved in the Link app), then 5am credits buy --pack <id> --spt <token> pays and waits for the credits. The token covers one pack, once.

Asking the owner (from CLI v1.8.0). An agent nobody is watching runs 5am credits buy --ask-owner --reason '…': the request arrives as a card in the account owner's 5AM Comms chat, with a push to their phone, where they approve and pay or decline, on the web or in the apps. 5am credits wait --request <id> waits for the answer. A managed workflow run and an AI character's token always ask the owner, since nobody is there to pay a link. Every plan can answer a request.

Where credits went (from CLI v1.8.8). 5am credits also shows held_credits, what calls still running have reserved, and used_credits. 5am credits history lists each ledger row and groups the rows by request: a Gemini call first holds its worst case, then settles to what it really cost. An open hold counts against your balance until it settles; one nobody settles within 12 minutes is charged in full (expired), and a late settle refunds the difference. An export fee is one row whose request id is the export's id; for clip outreach, the batch's batch.json keeps it per prospect.

Reading the JSON. In 5am credits, each amount comes twice: *_credits is the number to show people, and *_micros the raw ledger unit for scripts (1 credit is 1,000 micros, ai_credits.credit_micros). purchased_total_micros grows only with a purchase, which is why 5am credits wait --since takes it. The agent_payments block, with its step-by-step how, appears only while 5AM accepts payment with a Link token; it is for agents that pay that way, and other scripts can ignore it.

Using your own Gemini key instead. The CLI looks for Gemini access in this order: the GEMINI_API_KEY environment variable, a key stored with 5am keys set gemini <key>, the key saved in your account (Settings → Keys), and then your AI credits. The key saved in your account is read only with your own login or a token with write scope: a read-only token, an AI character's token or a workflow run's token never reads it. Where one of those runs the CLI, set GEMINI_API_KEY in that environment: it is used there and nowhere else. 5am keys set gemini <key> is not a local setting: it replaces the key saved in your account, for everything you run, needs a token with write scope, and then keeps a copy on this machine. From CLI v1.8.97, the CLI says which case it is: this token has read scope (use a token with write scope, or GEMINI_API_KEY) or this token belongs to an AI character or a workflow run (use GEMINI_API_KEY), and 5am keys list prints keys_hidden_reason (cli_read_scope or cli_token_not_person) beside whether your account has each key. Calls on your own key are billed by Google and use no credits. The exceptions are exports, which cost AI credits on every account, your own key included: 5am motion render (20 credits per film) and, video edit exports (5am media edit render, media highlight: 50 credits each; media clips: 50 per clip). Drafts are free and carry a small "Powered by 5AM" mark (VEDL: Drafts and exports); from CLI v1.8.94, a Motion draft (5am motion render --draft) is free too, at 360p with a large DRAFT mark (Motion: render). Prices may change; every command quotes the current one. 5am keys list shows which one the CLI is using (gemini_access.mode is byok, credits or none, with a reason when it is none).

Ask Gemini

One question to Gemini from the terminal, on your saved key or your AI credits: for scripts and programs that drive the CLI and should not hold a key of their own.

sh
5am ai ask --prompt "Which year did the Talk Python podcast start?" --search   # grounded in Google Search: text, sources, queries
5am ai ask --prompt-file question.txt --json                                  # one JSON value, parsed
5am ai ask --prompt "..." --search --thinking low                             # a Gemini 3 thinking level: minimal, low, medium or high
5am ai ask --prompt "..." --model gemini-4-hydrogen --thinking high           # Gemini 4 models take low, medium or high

--model takes any Gemini text model. From CLI v1.8.97, --thinking minimal is refused for Gemini 4 models such as gemini-4-hydrogen before any call (they have no minimal level).

With --search the answer carries grounded: true when a search informed it (Google cited pages, or fed its results into the model's context), false when the model answered from memory. A grounded run comes back empty now and then; the CLI tries once more, thinking less, before reporting it.

Albums

You can obtain an <albumId> by running the 5am albums list command.

sh
5am albums list                            # albums YOU own
5am albums list --search trip --limit 50   # from CLI v1.8.6: one page by name: {total, next_offset, albums}
5am albums list-shared                     # albums others have shared with you
5am albums shares <albumId>                # view all people who have access to this album
5am albums get <albumId>                   # fetch metadata for a single album
5am albums create --name "Trip 2026"
5am albums update <albumId> --name "Trip 2027" --description "Best trip ever"
5am albums delete <albumId> --yes          # needs a token with the admin scope; refused while the album has media

# Download all media from an album to a local directory
5am albums download <albumId> --output ./trip_photos --type image

# Generate an AI-powered natural language summary of the album's contents
5am albums generate-summary <albumId>

Sharing an Album

sh
# Share with an email (read-only)
5am albums share <albumId> --share alice@example.com

# Revoke a share
5am albums unshare <albumId> --user alice@example.com

# Public link: enable prints publicUrl, the link to post
# (viewers without a 5AM account sign up for free to open it)
5am albums public-link enable <albumId>
5am albums public-link get <albumId>       # the current link, or null while it's off
5am albums public-link disable <albumId>   # the old link stops working

Command Arguments:

  • <albumId>: The ID of the album.
  • --name: The name of the album (used for creation or updating).
  • --description: A description of the album.
  • --location: The location associated with the album.
  • --share: Accepts a single email, or a list of emails separated by a comma (e.g., alice@ex.com,bob@ex.com).
  • --user: The email address of the person whose access you want to revoke.

Media Management

Upload files, globs, or whole directories. HEIC/HEIF files are automatically converted to JPEG locally on macOS and Linux.

The CLI is the only client that can upload videos up to 10 GB (the web and mobile apps cap at 2 GB; requires a Premium or Ultra plan). Videos over 2 GB are processed locally before upload (the CLI extracts the poster and, when needed, encodes a web-playable 1080p proxy), so they need a local FFmpeg. Large files upload several parts in parallel per file, and interrupted uploads resume: if the connection dies partway, just run the same command again within a few days: already-uploaded parts (and the transcoded proxy) are reused, so only the missing pieces move.

sh
5am media list                             # your library, newest first (20 per call; see --limit)
5am media list --album <albumId>           # list media in a specific album
5am media list --added-after 2026-08-01    # only items uploaded on/after a date (ISO 8601)
5am media list --added-after 2026-07-01 --added-before 2026-08-01 --type image
5am media list --limit 100 --offset 100    # page through a large library (server caps --limit at 100)
5am media list --album "Trip 2026" --sort uploaded   # from CLI v1.8.6: album by name; --sort taken (capture date, undated last) or uploaded
5am media upload ./photos/*.jpg --album "Trip 2026"
5am media upload ./photos -r --new-album "Imports 2026"
5am media upload ./photos -r --album "Trip 2026" --skip-existing   # from CLI v1.8.6: leave out files already in your library
5am media upload ./footage/interview-4k.mov --album "Shoots"   # videos up to 10 GB (Premium/Ultra; ffmpeg needed over 2 GB)
5am media download <mediaId> --output ./photo.jpg
5am media delete <mediaId> --yes            # needs a token with the admin scope (a read/write token gets 403 insufficient_scope)

# Vector search by meaning (vs lexical --search). Each match has a similarity
# score; a partial match can pass (a beach with no dog for "a dog on the
# beach"), so read the scores or raise --min-score (from CLI v1.8.6, which also
# says why nothing matched, how many items are not indexed yet, and that a
# search costs under 1 AI credit)
5am media semantic-search "sunsets at the beach"
5am media semantic-search "a dog on the beach" --min-score 0.65
5am media semantic-search "a dog on the beach" --rank-with-model   # from CLI v1.8.6: a model keeps only full matches (a few AI credits)

# Local File Operations
5am media convert photo.heic --output photo.jpg
5am media resize cover.png --width 1920 --output cover_resized.png
5am media smartcrop photo.jpg --size 1080x1350 --output crop.jpg   # AI subject-aware crop; see "AI Smart Crop" below
5am media concat clip1.mp4 clip2.mp4 clip3.mp4 --output merged.mp4
5am media mix --voice episode.wav --music bed.mp3 --output mix.wav
# From CLI v1.8.95: line cameras up with the program audio for a multi-cam
# edit (offset, clock drift and confidence per camera; --script writes the
# `angle` lines, paths relative to the script; a file with over about 4 h 40 min
# of sound is refused; see /cli/docs/vedl#cut-between-several-cameras-with-angle)
5am media sync program.wav cam-wide.mp4 cam-ali.mp4 --wide cam-wide --script talk.vedl

# Timestamped, speaker-labeled AI transcript of a local video/audio file
# (json, srt, or vtt; feeds the AI video tools at /cli/docs/ai-video-clip)
5am media transcribe talk.mp4
5am media transcribe episode.wav --format srt -o episode.srt

# Generate an AI description at upload time, computed locally with Gemini
# (your AI credits or your own key): images get classifier tags + a search
# description; video/audio a summary of the audio track, even for 10 GB files
5am media upload ./footage -r --album "Shoots" --describe

# Generate an AI-powered natural language summary of a media file
5am media generate-summary <mediaId>

Command Arguments:

  • --album: Adds the uploaded media to an existing album by name or ID.
  • --new-album: Creates a new album with the specified name and adds the media to it.
  • --added-after / --added-before: Only items uploaded on/after (on/before) the given ISO 8601 date. This filters when the item entered your library, not the photo's EXIF capture date. An invalid date is rejected with an error rather than silently ignored.
  • --limit / --offset: Listing page size (default 20, server caps at 100) and offset. To walk a large library, repeat the call increasing --offset until a page comes back smaller than the limit.
  • -r: Recursively scans directories for media files.
  • --part-concurrency: Parallel multipart parts per file for large uploads (default 4).
  • --ffmpeg: Path to the ffmpeg binary (default: $FFMPEG, then PATH); required for videos over 2 GB.
  • --describe: Generate an AI description for each upload with Gemini (your AI credits or your own key). Images get classifier tags + a search description, video/audio a summary of the audio track (ffmpeg required for video/audio).
  • <mediaId>: The ID of the specific media file (obtainable by running 5am media list).

AI Smart Crop

Crop photos to a target size or aspect ratio with AI subject detection: Gemini Vision locates the main subject (faces first) and the crop keeps it fully in frame, instead of blindly cutting the center. Perfect for turning a landscape shot into an Instagram portrait or a square thumbnail without decapitating anyone. Image processing runs locally in the CLI; only the small detection call uses Gemini (your AI credits or your own key).

sh
# Exact output size: crop to the 4:5 region around the subject, then scale to 1080x1350
5am media smartcrop photo.jpg --clue "make sure faces are in the frame" \
  --size 1080x1350 --output crop.jpg

# Aspect-ratio mode: the largest 4:5 region at native resolution, never resampled
5am media smartcrop photo.jpg --aspect 4:5 --output crop.jpg

# Literal pixel window: cut exactly 1080x1080 from the source, no scaling
5am media smartcrop photo.jpg --size 1080x1080 --no-scale --output crop.jpg

# Batch a local folder, or an entire album straight from your account.
# Files land in --output-dir as <name>-smartcrop.<ext>
5am media smartcrop --folder ./photos --aspect 1:1 --output-dir ./cropped
5am media smartcrop --album "Trip 2026" --size 1080x1350 --output-dir ./cropped

Command Arguments:

  • --clue: Optional plain-language guidance for the detector (e.g., "keep both people", "focus on the red car"). Overrides the default face-first preference when they conflict.
  • --size: Exact output size in pixels as WxH (e.g., 1080x1350): crops to that aspect around the subject, then scales to exactly that size.
  • --aspect: Target aspect ratio as W:H (any integer ratio: 4:5, 3:2, 16:9, ...): crops the largest matching region at native resolution, never resampled.
  • --no-scale: With --size, cut a literal WxH pixel window instead of crop-and-scale (errors if the source is smaller).
  • --output / --output-dir: Output file for single-photo mode, or the output directory for batch mode (multiple paths, --folder, or --album).
  • --quality: JPEG output quality 1–100 (default 90; PNG and WebP are unaffected).
  • --cache: Path of the local subject-box cache (default ~/.5am/collage-subjects.json, shared with 5am media collage --smart-crop, so a photo detected by one is a free cache hit for the other).
Note:

Photos only: PNG, JPEG, and WebP in, same format out (convert HEIC first with 5am media convert). Uses Gemini access (your AI credits or your own key). Detected subject boxes are cached locally by content hash, so re-running a crop at a different size is instant and free; when no clear subject is found, the crop falls back to a sensible centered, top-biased framing rather than failing. Run it without --size/--aspect in a terminal and it asks interactively; in scripts, pass the flags.

Local Slideshow

Launch a local web server to view a beautiful, full-screen slideshow of media. Navigate with the Left/Right arrows, Space to pause/play, and f for fullscreen.

sh
5am media slideshow --folder ./photos --delay 5s
5am media slideshow --album "Trip 2026" --delay 10s --metadata
5am media slideshow --album all --delay 8s --metadata          # every album, in one continuous slideshow

Smooth playback. The next few slides are prefetched while the current one plays, so videos start without a stall instead of buffering cold on first play. For album sources, the slideshow streams the lighter, faster version of each item when your library has one (a video's converted +faststart MP4 rather than the raw .mov, and a large image variant rather than the full-resolution original), falling back to the original when no variant exists.

On-disk cache (albums). Each album item is downloaded from your account once and cached on disk (default ~/.5am/slideshow-cache, capped at 2 GB), then served locally on every subsequent loop. This survives browser cache eviction and persists across runs, so looping a large album doesn't re-download it every pass. The cache serves HTTP Range requests, so video seeking and replay keep working.

sh
5am media slideshow --album "Trip 2026" --cache-size 8192              # bump the cap to 8 GB
5am media slideshow --album "Trip 2026" --cache-dir /mnt/ssd/5am-cache # custom location
5am media slideshow --album "Trip 2026" --no-cache                     # always fetch from the backend
5am media slideshow --album "Trip 2026" --cache-size 0                 # unbounded (no eviction)

Command Arguments:

  • --folder: Path to a local directory containing images.
  • --album: An album name or ID to stream directly from your 5AM account, or all to play every album in one continuous slideshow.
  • --delay: Duration to show each image before transitioning (e.g., 5s, 10s).
  • --metadata: Overlays EXIF metadata and AI-generated descriptions on the slideshow.
  • --host: IP to bind the local server to (default 127.0.0.1; use 0.0.0.0 for LAN access).
  • --no-cache: Disable the on-disk media cache (albums only); always fetch from your account.
  • --cache-dir: Directory for the on-disk media cache (default ~/.5am/slideshow-cache).
  • --cache-size: Max cache size in MB (default 2048; 0 = unbounded).
sh
# Lexical search (filenames, EXIF, etc.)
5am media list --album <albumId> --search "sunset"

# Semantic AI search (finds photos that "look like" the query)
5am media semantic-search "sunsets at the beach"

AI Media Generation

Generate images, video, audio, and text using local CLI commands.

Note:

Gemini generation runs on your AI credits, or on your own Gemini key when you have set one (see AI Credits). Video uses far more credits than images or text, so check 5am credits before a big batch. --provider openai needs your own OpenAI key (5am keys set openai <key>, or Settings → Keys); OpenAI calls never use AI credits. From CLI v1.8.97 the OPENAI_API_KEY environment variable comes first, a key for that environment only: use it where the CLI runs on a read-only token or an AI character's token, which never read the key saved in your account.

sh
# Image Generation (gemini-2.5-flash-image, gemini-3.1-flash-image, gemini-3-pro-image)
5am media generate image --prompt "a cybernetic owl" --provider gemini --output owl.png

# Image editing / composition: mix the prompt with input images (repeat --image, up to 14)
5am media generate image --prompt "put this logo on a coffee mug, photorealistic" \
  --image logo.png --image mug.jpg --model gemini-3-pro-image --output mockup.png

# Aspect ratio + resolution (resolution is Gemini 3.x-only: 512 | 1K | 2K | 4K)
5am media generate image --prompt "a desert highway at golden hour" \
  --model gemini-3.1-flash-image --aspect-ratio 16:9 --resolution 2K --output road.png

# Google Search grounding: base the image on real-time facts (weather, events, data)
5am media generate image --prompt "a chart of today's weather in San Francisco" \
  --model gemini-3.1-flash-image --grounding --aspect-ratio 16:9 --output weather.png

# Video generation (gemini-omni-1.2-flash, which replaced Veo): one clip of 3 to 15 seconds
5am media generate video --prompt "a flowing river in autumn" --output river.mp4
5am media generate video --prompt "a flowing river in autumn" \
  --aspect-ratio 9:16 --resolution 1080p --duration 10 --output river-vertical.mp4

# Image-to-video: animate from an initial frame, or interpolate to a last frame
5am media generate video --prompt "slow zoom out" --image start.png --output clip.mp4
5am media generate video --prompt "she fades away" --image first.png --last-frame last.png --output interp.mp4

# Reference images: keep a person, product, or garment consistent
# (repeatable; cannot combine with --image/--last-frame)
5am media generate video --prompt "office group photo, funny faces" \
  --reference-image person1.png --reference-image person2.png --output group.mp4

# Video extension: continue a clip of 10 seconds or less from where it ended
5am media generate video --prompt "Continue the scene: track the butterfly into the garden" \
  --extend butterfly.mp4 --output butterfly-extended.mp4

# Get a native desktop notification when a slow generation finishes (see "Desktop Notifications" below)
5am media generate video --prompt "a flowing river in autumn" --output river.mp4 --notify

# Audio & Music
5am media generate music --prompt "lo-fi hip hop for studying" --output chill.mp3
5am media generate audio --text "Hello, I am your AI assistant" --voice Puck --output hello.wav

# Text Generation
5am media generate text --prompt "Write a short poem about an AI learning to code" --output poem.txt

# Multimodal text: ask about local images (repeatable --image)
5am media generate text --prompt "Tell me about this instrument" --image organ.jpg

# Audio, video, or PDF input (repeatable --file)
5am media generate text --prompt "Summarize this lecture in five bullets" --file lecture.mp3

Command Arguments:

  • --prompt: The textual description of what the AI should generate.
  • --provider: Which AI model provider to use (e.g., gemini, openai).
  • --model: Specific AI model to use (see Supported Models below).
  • --output: The local file path where the generated media will be saved. An image is written in the format its extension names (.png, .jpg/.jpeg or .webp): Gemini returns JPEG, so from CLI v1.8.8 the CLI converts it and the JSON result says converted_from. Earlier releases kept the bytes' own format and changed the extension instead (owl.jpg for --output owl.png).
  • --text: The text script for text-to-speech generation.
  • --voice: The named voice profile to use for speech generation.
  • --image / --last-frame (video): First frame for image-to-video; add --last-frame to interpolate between two frames (--last-frame requires --image).
  • --duration (video): Clip length in whole seconds, 3 to 15 (8 by default; 3 to 10 with --last-frame). From CLI v1.8.97; earlier releases, and --model gemini-omni-1.1-flash, take 4, 6, 8 or 10.
  • --reference-image (video, repeatable, up to 6): Asset reference images (.png/.jpg/.webp) so a person, product, or garment stays consistent in the generated clip. Call them "reference image 1", "reference image 2", ... in the prompt to point at one (from CLI v1.8.97 the CLI states each image's role in words and rewrites an old <IMAGE_REF_0> tag to them). Cannot be combined with --image/--last-frame.
  • --extend (video): Continue a local clip (.mp4/.mov/.webm) of 15 seconds or less (10 on gemini-omni-1.1-flash and before CLI v1.8.97) from where it ended. --duration is then the length to add, 3 to 10 seconds (without it the model picks), and --reference-image can bring a character or object into the continuation. The clip is uploaded through the Gemini Files API and deleted after. Cannot be combined with --image/--last-frame. Google does not allow extending uploaded videos in the EEA, Switzerland or the UK.
  • --image (image, repeatable): Input/reference images for editing or composition: edit a photo, combine subjects, apply a style. Up to 14 per request on the Gemini 3.x models.
  • --aspect-ratio, --resolution (image): Any supported ratio (1:1, 16:9, 4:5, 21:9, ...); size 512/1K/2K/4K on Gemini 3.x models (gemini-2.5-flash-image is 1024px only).
  • --grounding, --grounding-images (image): Ground the image in real-time Google Search results (weather, events, live data); --grounding-images additionally uses image-search results as visual context (gemini-3.1-flash-image only).
  • --image (text, repeatable): Include local images alongside a text prompt: describe a photo, write alt text, extract or compare visual details.
  • --file (text, repeatable): Include audio (.mp3/.wav/.m4a/.aac/.flac/.ogg), video (.mp4/.mov/.webm), or .pdf files with the prompt: summarize a recording, answer questions about a document. Uploaded via the Gemini Files API and deleted after.
  • --aspect-ratio, --resolution, --duration, --negative-prompt (video): 16:9 (default) or 9:16; 360p, 720p (default), 1080p or 4k (the last two are upscaled from the model's output); 4, 6, 8 (default) or 10 seconds; what to avoid (added to the prompt as "Do not include: ...").

Supported Models (Gemini):

  • Image: gemini-3.1-flash-image, gemini-3-pro-image, gemini-2.5-flash-image
  • Video: gemini-omni-1.2-flash is the default from CLI v1.8.97 (earlier releases run gemini-omni-1.1-flash, which -m still accepts). The Omni models replaced the Veo 3.1 previews, which Google turned off on 2026-10-22; a retired veo-* id is still accepted and mapped to the default.
  • Text: gemini-3-flash-preview, gemini-3.8-flash, gemini-4-hydrogen (from CLI v1.8.97), gemini-3.5-flash-lite, gemini-3.1-flash-lite, gemini-3.1-pro-preview

Desktop Notifications (--notify)

The long-running, "go make coffee" commands can ping you with a native OS notification the moment they finish: useful when you kick off a minutes-long generation, switch to another window, and don't want to babysit the terminal.

sh
# Notify when this command completes
5am media generate video --prompt "a flowing river in autumn" --output river.mp4 --notify

# Or turn it on for the whole session via an environment variable
FIVEAM_NOTIFY=1 5am media collage --folder ./photos --music "warm piano" --output memory.mp4

--notify is a global flag (off by default) and is honored by the commands that actually take a while: media generate image|video|music|audio, media collage, media concat, media visualize, media mix, and albums download. Fast commands ignore it.

Note:

Notifications use your OS's built-in tool (osascript on macOS, notify-send (libnotify) on Linux, a PowerShell toast on Windows), with no extra install. They're best-effort: if no desktop notifier is reachable (e.g. over SSH or on a headless box), the CLI still rings the terminal bell as a fallback, and a missing notifier never affects the command's result.

AI Video Editing: Highlights & Clips

The audio/video production tools moved to their own page: podcast & video tools (media visualize, the podcast-to-video helper, and the media mix auto-ducking), AI highlight reels (5am media highlight and the edit subcommands), AI short clips & Clip Maker (5am media clips and 5am studio), memory collage videos (5am media collage), and the full VEDL language reference.

AI Video Editing reference →

Motion Films

Make motion-graphics films from a brief: kinetic type, charts, counters, your photos and video clips, cut to a beat with a composed score and optional narration. It runs the same engine as Motion Studio, so a film made here is the same document as one made on the web. Needs CLI v1.5.0 or later, the optional runtime (5am update --runtime-only, which also installs Skia, the engine that draws the films) and Node.js 20+, plus FFmpeg to look at or render a film. CLI v1.6.2 and earlier draw with Chrome instead; Chrome is now only the rollback (--engine chrome).

sh
5am motion generate --brief "A 10 second launch film for a coffee app" --format 9:16 --duration 10 -o coffee.motion.json
5am motion revise coffee.motion.json "warmer colours, slower ending" --in-place
5am motion sheet coffee.motion.json -o coffee.png             # free contact sheet
5am motion render coffee.motion.json -o coffee.mp4 --fps 30   # an export: 20 AI credits

Checking a film is free (lint, stills, sheet, preview, and from CLI v1.8.94 inspect), and so is a draft: from CLI v1.8.94, render --draft makes a 360p MP4 with the sound and a large DRAFT mark, on your computer. render costs 20 AI credits per export (from CLI v1.8.4, 100 for a clip made with 5am motion podcast), and every film carries a small "Made with 5AM.app" mark. Narration (narrate), video clips (--clip), offline fonts and the full film format are covered in the reference.

Motion Films reference →

Clip Outreach & Pipeline

Send each prospect a short clip made for them, review every email in your AI character's chat (or on this computer), and send from your own Gmail. The batch commands (5am outreach), the pipeline your AI character keeps (5am pipeline) and the no-login page for one video (5am media public-link) moved to their own page, with why it works this way, the ways to use it, and a first batch step by step.

Clip Outreach & Pipeline reference →

AI Characters & Agents

Everything character-related moved to its own page: creating and chatting with AI Characters, webhooks, server skills, API keys, custom local skills, Server Agents & datasets, and the multi-character AI Playground.

AI Characters & Agents reference →

AI Agents (MCP)

Give Claude, Claude Code, Codex, Antigravity or any MCP client this CLI as tools: 5am mcp serves video editing, your library, albums, photo edits, Motion films and clip outreach to the agent, and every paid step or email waits for your yes. Needs CLI v1.7.0 or later.

sh
claude mcp add 5am -- 5am mcp

AI Agents (MCP) reference →

Examples

Batch Resize, Convert, and Upload Images Recursively (macOS and Linux)

Since 5am media resize operates on a single file at a time and preserves the input format, you can combine it with 5am media convert and 5am media upload in a simple shell loop to batch process, resize, convert, and upload a directory of images (e.g., converting all .png files to .jpg resized to 1920px width, and uploading them to a target 5AM album):

sh
# Find all PNGs recursively, resize them to 1920px width,
# convert them to JPG, and upload them to a 5AM album
find ./photos -type f -name "*.png" | while read -r img; do
  # Determine temp and target paths
  temp_resized="${img%.*}_resized.png"
  target_jpg="${img%.*}_resized.jpg"
  
  # 1. Resize the image (PNG -> PNG)
  5am media resize "$img" --width 1920 --output "$temp_resized"
  
  # 2. Convert to JPEG (PNG -> JPEG)
  5am media convert "$temp_resized" --output "$target_jpg" --quality 90
  
  # 3. Upload to 5AM album
  5am media upload "$target_jpg" --album <albumId-or-name>
  
  # Clean up temporary files
  rm "$temp_resized"
  rm "$target_jpg"
done

FAQ

What exactly is considered a "media file"?
A media file in 5AM encompasses all common image, video, and audio formats. This includes standard images (.jpg, .png, .webp, .gif), Apple's high-efficiency image formats (.heic, .heif), all standard video formats (.mp4, .mov, etc.), and audio formats (.mp3, .wav, etc.).

Where are my token and keys stored?
The CLI keeps your login token, your API keys and the Gmail credential 5am outreach sends with in your system's keychain (Keychain Access on macOS, Secret Service on Linux, Credential Manager on Windows) when one is available. Where none is (most servers, containers and AI agents' computers), it keeps them in config.toml in the CLI's config folder (~/.config/5am/ on Linux, or your OS equivalent), readable only by your user; set FIVEAM_DISABLE_KEYRING=1 to go straight there without trying a keychain. 5am logout removes them. FIVEAM_TOKEN, GEMINI_API_KEY and FIVEAM_GMAIL_ADDRESS / FIVEAM_GMAIL_APP_PASSWORD are read before anything stored, for scripts that keep their secrets elsewhere.

Why does export 5AM_TOKEN=... fail?
A shell variable's name cannot start with a digit, so bash and zsh refuse export 5AM_TOKEN=... and even 5AM_TOKEN=... 5am whoami. Write every one of the CLI's variables with FIVEAM_ instead: FIVEAM_TOKEN, FIVEAM_BASE_URL, FIVEAM_CONFIG_DIR, FIVEAM_DISABLE_KEYRING, FIVEAM_PRETTY and FIVEAM_NOTIFY work from CLI v1.8.0, and the rest (FIVEAM_NO_UPDATE_CHECK, FIVEAM_SKILLS_DIR, FIVEAM_AGENT_DIR, FIVEAM_SHELL, FIVEAM_ALLOW_OUTSIDE_WORKSPACE) from CLI v1.8.8. When both spellings are set, 5AM_ wins.

Why do some media commands fail saying ffmpeg is missing?
Advanced media commands, such as 5am media visualize, 5am media concat, 5am media collage, 5am media mix, 5am media transcribe, 5am motion render, 5am outreach prepare and clips, and uploading videos larger than 2 GB, require the powerful FFmpeg library to process media. You can install it via your system's package manager (e.g., brew install ffmpeg on macOS, apt install ffmpeg on Linux, or winget install ffmpeg on Windows). A binary that is not on PATH works too: point $FFMPEG at it once per shell session, or pass --ffmpeg /path/to/ffmpeg to the command.

Does it work offline?
Commands that interact with the 5AM platform or AI providers require an internet connection. Local conversion and visualization commands (media convert, media visualize) run entirely offline.