Pixr CLI
When To Use
Use this skill when the task is specifically about the local pixr CLI in this repository or its home-directory defaults under ~/.pixr.
Typical triggers:
- "generate an image with pixr"
- "edit an image with pixr"
- "create variations with pixr"
- "set the pixr model"
- "save images to a default folder"
- "use the refs from ~/.pixr/assets"
- "init a pixr profile"
- "make a profile use a different model or save dir"
- "show the pixr profile layout"
- "show what pixr supports"
- "fix or inspect pixr config"
Do not use this skill for general image-API design discussions that are not tied to this CLI.
Providers And Models (Never Assume Either)
pixr works with gemini (default), openai (any OpenAI-compatible API), openrouter, and fal. There is no built-in model and no hardcoded capability list: the user chooses the provider and model for each task, and everything about a model comes live from the provider.
- Pick the provider with
--provider,--base-url, and--api-key-env <ENV_VAR_NAME>(or a profile /commands.<name>in config). Checkpixr config --jsonfor what is resolved and whether a key is loaded. - Find models:
pixr models --provider <p> --search "<text>" [--category image-to-image] --json. - Check what a model supports before using it:
pixr models --info <model> --provider <p>(parameters, input image limit, native mask field). Gemini and OpenAI-compatible APIs publish nothing; then requests are sent as asked. - Pass provider parameters with
--param name=value(JSON values;@file.pngbecomes an image data URL). Do not invent parameter names; use the ones--infolists. - Never choose a model for the user because a task "needs" one (for example background removal or upscaling). Search the catalog, show the options, and use the one the user picks.
Execution Mode
Prefer the installed binary when available:
pixr
If you are working inside this repo and do not want to depend on a global link, use:
npm run dev -- <command>npm run pixr -- <command>
Core Workflow
- Start by checking the exact command surface instead of assuming flags.
Use
pixr helpfor global help orpixr <command> --helpfor command help. - If the task is generation, inspect saved defaults first when they matter.
Run
pixr config --json. - If the task depends on profile-specific defaults, inspect or scaffold them first:
pixr profile listpixr profile show <name>pixr profile init <name>pixr config --profile <name> --json
- If the task depends on a saved model or output directory, prefer the dedicated commands over editing config by hand:
pixr model ...pixr save-dir ...
- If the task depends on reusable prompts or style, use the home-directory files:
~/.pixr/INSTRUCTION.md~/.pixr/STYLE.md~/.pixr/prompts/<command>.md~/.nano-image/STYLE.md
- If the task uses default reference images, inspect
~/.pixr/assetsor~/.pixr/profiles/<name>/assetsand verify withpixr refs --json. Remember that pixr keeps only the latest three default asset images by modified time. - After changing behavior, validate with one concrete CLI command and capture the resulting output path or config state.
Image Workflows
For generation details and command recipes, read references/command-reference.md.
Key rules:
- Use
generateorgenfor prompt-only creation. - Use
editfor text-guided changes to an existing image. - Use
varyfor one or more variations of an existing image. - Use
edit <image> --mask <mask.png>to change only part of an image (white = change, black = keep, same size as the input). Make masks withpixr mask <image> --rect x,y,w,h(or--ellipse). Outpaint withpixr extend <image> --pad ..., which also writes the mask of the new area. editworks with any image-to-image model; the prompt is optional for models that take none.- Local tools that need no provider or key:
pixr info,resize,crop,extend,mask,grid(gridputs several candidates in one sheet to compare). - For automation:
--json,--no-stdin, and errors arrive as JSON on stderr with exit code 1 (2 for usage errors). -wplus-hstretches an image of a different shape (pixr warns); use one of them to keep the shape.- Respect saved defaults from
~/.pixr/config.json. - If the user passes
--save-toor--output, that overrides the saved default output directory. - Width-only or height-only requests preserve aspect ratio during local resize.
- Width plus height forces the final image to the exact requested dimensions.
- Format defaults to
png;jpg,jpeg, andwebpare supported through local conversion.
Generate Workflow (Simple and Direct)
When generating from scratch:
- Write one clear prompt for the full scene.
- Run
pixr generate "<prompt>"(orpixr gen "<prompt>"). - Check the output image.
- If changes are needed, do not keep stretching a single prompt forever.
- Either:
- regenerate with a clearer prompt, or
- switch to iterative
pixr editpasses for controlled refinements.
Edit Workflow (Layered, Never One-Shot)
For edits, use a Photoshop-style layer mindset.
Mandatory rules:
- Never try to do the whole edit in one prompt.
- Break the task into the smallest possible edit layers.
- Run one edit layer at a time.
- Inspect the resulting image after every layer.
- Continue from the latest good output image as the next input.
- If a layer result is off, fix only that layer in the next pass.
Recommended layer order (smallest changes first):
- Cleanup or artifact fixes.
- Subject geometry and proportions.
- Main object details.
- Background elements.
- Lighting and shadows.
- Color grading and style polish.
- Final upscale/resize/format conversion.
Per-layer loop:
- Define one micro-goal (single visual change).
- Run one
pixr editcommand focused only on that micro-goal. - Review the output image.
- Accept and move forward, or retry that same layer with a tighter instruction.
Example iterative sequence:
pixr edit --input in.png --prompt "Remove small background clutter only; keep subject unchanged."- Check output.
pixr edit --input step1.png --prompt "Adjust face proportions slightly; keep lighting and colors unchanged."- Check output.
pixr edit --input step2.png --prompt "Add warm rim light on subject; do not alter composition."- Check output and continue.
Prefer precise constraints in edit prompts:
- "only"
- "keep unchanged"
- "do not alter composition"
- "preserve identity"
- "preserve camera angle"
Configure Defaults
For persistent settings and file layout, read references/defaults-and-files.md.
Prefer command-driven config changes:
- Save model:
pixr model <name>(list real names first withpixr models) - Pick model interactively:
pixr models - Save default output dir:
pixr save-dir --set "<path>" - Clear saved output dir:
pixr save-dir --clear-save-dir - Save profile defaults:
pixr profile init <name> --model ... --save-dir ... - Use interactive profile setup:
pixr profile init <name>
Avoid editing ~/.pixr/config.json directly unless the user explicitly asks for a manual file edit.
Troubleshooting
Read references/troubleshooting.md when:
- generation fails
- models do not list
- the picker or config looks wrong
- output paths or refs are not being used
Validation
After making changes or guiding usage:
- run one obvious command that should succeed
- use
--jsonwhen you need machine-readable confirmation - report the exact saved model, output directory, or generated file path when relevant
