meta-ai is a CLI and Deno package for authenticated Meta AI image, video,
and history workflows. Log in once with a real browser, save the resulting
session file, and then reuse that session for image generation, animation,
video generation, history download, and history cleanup.
- CLI command:
meta-ai - JSR package:
@cliat/meta-ai - Auth model: explicit browser login captured to a reusable session file
- Default session path:
~/.auth/cliat@meta-ai.json
See COMMANDS.md for the short cheat sheet. This README is the full CLI guide.
Choose one way to run the CLI:
Run directly from JSR:
deno x jsr:@cliat/meta-ai/cli --helpInstall onto PATH:
deno install -g -A --name meta-ai jsr:@cliat/meta-ai/cli
meta-ai --helpRun from this repo:
deno run -A ./cli.ts --helpor build a binary:
deno task compile
./bin/meta-ai-x86_64-unknown-linux-gnu --helpOn Windows, run .\bin\meta-ai-x86_64-pc-windows-msvc.exe --help.
auth login opens a headed browser through playwright-cli. Install it once and
install a browser before your first login:
npm install -g @playwright/cli@latest
playwright-cli install-browser --browser=chromeauth login is the only command that launches Playwright directly, but every
later authenticated command still depends on a valid session file produced by
auth login.
- Prompt box ->
image create --prompt ...orvideo create --prompt ... - Aspect selector ->
--aspect 9:16|1:1|16:9appended to the generation prompt - Image count selector ->
image create --count <n> - Animate button or prompt ->
image create --animate [text] --video-out <path> - Extend action ->
--extend <n>
This CLI uses explicit browser-auth session reuse. The documented default session path is:
~/.auth/cliat@meta-ai.jsonRun login with the default path:
meta-ai auth loginImportant behavior:
--session-path <path>is a global override and defaults to~/.auth/cliat@meta-ai.json--url <url>is optional and defaults tohttps://meta.ai/createauth loginopens a real browser and waits until a Meta session cookie is present- the saved file contains only the Meta auth material the runtime reuses later
- later authenticated commands use the same default path automatically unless
--session-pathoverrides it ~is resolved againstHOMEon Unix-like systems andUSERPROFILEon Windows- keep session files user-local and never commit them
Every command supports the global --json flag. Authenticated commands also
inherit the global --session-path flag.
Open a browser and write a reusable Meta session to disk.
Optional flags:
--session-path <path>--url <url>
Example:
meta-ai --json auth loginGenerate images and optionally animate and extend them.
Required flags:
--prompt <text>--image-out <path>
Optional flags:
--session-path <path>--video-out <path>--animate [text]--aspect <ratio>defaults to9:16--count <n>defaults to1--extend <n>defaults to0
Important behavior:
--video-outrequires--animate--extendrequires--animate--aspectappendsaspect <ratio>to the generation prompt- if
--animateis present without text, the default animation prompt isAnimate - image output paths are treated as base names and become numbered
.jpgfiles - animated video output paths are treated as base names and become numbered
.mp4files - the command returns a stable
conversationIdalongside downloaded files
Create one image:
meta-ai --session-path ~/.auth/cliat@meta-ai.json image create \
--prompt "a cinematic close-up of a fox in snowfall" \
--image-out out/fox \
--aspect 1:1Create two images, animate both, extend both twice, and download all files:
meta-ai --session-path ~/.auth/cliat@meta-ai.json image create \
--prompt "a neon koi fish in a dark pond" \
--image-out out/koi \
--count 2 \
--aspect 9:16 \
--animate "slow water ripple and gentle camera drift" \
--video-out out/koi \
--extend 2Generate videos directly and optionally extend them.
Required flags:
--prompt <text>--video-out <path>--aspect <ratio>
Optional flags:
--session-path <path>--extend <n>defaults to0
Important behavior:
--aspectis required here; there is no default--aspectappendsaspect <ratio>to the generation prompt- output paths are treated as base names and become numbered
.mp4files --extendapplies to every returned video- this Meta flow currently returns 4 video variants
Generate videos directly, extend every returned variation once, and download all of them:
meta-ai --session-path ~/.auth/cliat@meta-ai.json video create \
--prompt "a paper airplane gliding through clouds" \
--video-out out/plane \
--aspect 16:9 \
--extend 1Download generated media from your Meta create and vibes history.
Required flags:
--out <path>
Optional flags:
--session-path <path>--delete
Important behavior:
--outmust point to a directory- the command writes every discovered generated file under that directory
--deleteremoves only the prompts tied to files written by that invocation- when the feed omits prompt ids, the command resolves them from
create/<mediaId>pages before deleting
Download all generated history media into a directory:
meta-ai --session-path ~/.auth/cliat@meta-ai.json history download \
--out out/historyDownload saved history media and then remove only the prompts whose files were written by that invocation:
meta-ai --session-path ~/.auth/cliat@meta-ai.json history download \
--out out/history \
--deleteRemove generated prompts from Meta history without downloading files.
Required flags:
--force
Optional flags:
--session-path <path>
Important behavior:
- this command is destructive
--forceis required- the command removes generated prompts from Meta history using the same prompt
id recovery strategy as
history download
Remove generated prompts from Meta history without downloading:
meta-ai --session-path ~/.auth/cliat@meta-ai.json history clear \
--force- human-readable output is the default
- every command supports
--json --jsonwrites machine-readable output to stdout only- errors and progress messages go to stderr
- file-producing commands require explicit output flags
auth loginreports the saved session path and cookie countimage createreports theconversationId, downloaded images, and any downloaded animation results, including saved paths and media idsvideo createreports theconversationIdand downloaded videoshistory downloadreports downloaded files and any prompt ids deleted by--deletehistory clearreports the removed prompt ids
image createdefaults to--count 1image createdefaults to--aspect 9:16video createrequires--aspect--aspectcurrently works by appendingaspect <ratio>to the prompt while still sending the legacy orientation metadata--extendapplies to every animated or generated video- output paths are treated as base names and become numbered files
history downloadpaginates Meta'smediaLibraryFeedGraphQL connectionhistory clearuses Meta's delete mutation with a short pause between deletes- generated media under
out/andhistory/is intended to stay local
The package root stays library-first. The ./cli export is the Deno CLI entry.
You can load the same session JSON that meta-ai auth login writes.
import { MetaAiClient, type StorageState } from "jsr:@cliat/meta-ai";
const storageState = JSON.parse(
await Deno.readTextFile("./meta-session.json"),
) as StorageState;
const client = new MetaAiClient(storageState);
// The selected aspect is appended to the submitted prompt.
const result = await client.createImage("a fox in snowfall", "1:1", 1);Run locally:
deno task check
deno task compileRelease and publish:
deno task publish:dry-run
deno task version
deno task compile
deno publish