Image generation

marmot image generates images via OpenAI, OpenRouter, Vercel AI Gateway, or Cloudflare Workers AI.

marmot image <prompt> [flags…]

Providers: openai, openrouter, vercel, cloudflare. On first run, marmot detects available API keys in the env and auto-configures a default in this order: openroutervercelcloudflareopenai. Override any time with marmot setup, marmot config set, or --provider.

Output

Default behavior is TTY-aware:

InvocationOutput
marmot image '...' (terminal)Writes auto-named file in CWD, prints the file path on stdout.
marmot image '...' > out.pngWrites raw image bytes to stdout (auto-binary, n=1 only).
marmot image '...' | somethingSame — bytes on stdout.
marmot image '...' -o cat.pngWrites to cat.png, prints the path.
marmot image '...' --binaryForces raw bytes regardless.
marmot image '...' --b64JSON envelope with inline base64.
marmot image '...' --jsonWrites file, emits full JSON envelope.

Multi-image (--n > 1) always writes files and emits one path per line on stdout (or the JSON envelope under --json).

Examples

marmot image 'a marmot in space' > marmot.png && open marmot.png
marmot image 'a marmot in space' -o ./out.png
marmot image 'a marmot in space' --n 4 -o './out-{i}.png'

# Pipe to a viewer in iTerm2
marmot image 'a marmot in space' | imgcat

Flags

For cross-cutting flags (--provider, --api-key, --retries, --timeout) see Common flags. Image-specific:

FlagDescription
--model <id>Image model. Defaults to provider's default.
-o, --output <path>Output path. {i} template for batches (e.g. ./out-{i}.png).
-p, --prompt-file <path>Prompt from a file.
--n <count>Number of images (1–10, default 1).
--size <WxH>Image size (provider-specific allowed values).
--quality <level>Provider-specific (e.g. hd, low/medium/high).
--style <style>Provider-specific (e.g. vivid/natural).
--seed <n>Reproducibility seed (Cloudflare, some Vercel models).
--negative <prompt>Negative prompt (Cloudflare).
--binaryForce raw bytes to stdout. Requires --n 1.
--b64JSON envelope with inline base64; no file written.
--jsonEmit JSON envelope on stdout. Default prints just the path.

--binary, --b64, --json, and -o are independent — pick the one that matches your workflow. --binary requires --n 1.