Skip to main content
The Flatkey CLI brings media generation to your terminal against one balance. Every command accepts --json, which makes it safe to call from a script, a CI job, or an AI agent that parses stdout.

Install and authenticate

Requires Node.js 18 or newer. For CI, set an environment variable instead of logging in:
Check what the CLI is using:

Generate your first file

Always pass --model. The built-in default image model is not currently routable and returns No available channel.

Commands

Global options

Place -o before --json. The short form is rejected as an unexpected argument when it appears after --json. --output works in any position.

Video options

--ratio accepts 16:9, 9:16, 4:3, 3:4, 21:9, and 1:1. --resolution accepts 480p, 720p, and 1080p, but each model supports only part of that range — see Video generation.

Audio options

Run flatkey audio voices --json and pass a listed voice_id to --voice-id.

Drive it from an agent

In --json mode, stdout holds exactly one JSON object and stderr holds a JSON error. Run flatkey help --ai to print a compact protocol description an agent can read at runtime.
List models first, then generate. A hard-coded model id is the most common cause of a failed run.

Recovery

Retry only after changing the request. These errors are deterministic, so repeating identical arguments burns time without changing the outcome.