Masonry Logo
AI & Technology

Generate Images in Claude Code with Masonry CLI (2026)

A tested Masonry CLI workflow for starting an image or video job, waiting for it, and downloading the file—plus the current Claude initializer caveat.

Gaurav BisenGaurav Bisen
7 min read

Claude Code can generate an image or video when you give it a shell command that creates the file. The dependable workflow is not a magical plugin: start a hosted job, retain the job ID, wait for completion, download the result to an explicit path, and inspect the file before referencing it in code.

We checked the installed Masonry CLI and authenticated catalog on 4 August 2026. The catalog returned 30 image routes and 29 video routes. We also ran the Claude initializer in a clean directory and found a caveat worth knowing before you automate it: the generated command files currently contain a hard-coded binary path and a stale default model. The direct CLI workflow below is the part that worked end to end.

Quick answer: the working command sequence

Prompt

# run the package entry point npx @masonryai/cli # connect your Masonry account masonry login # inspect current routes and the selected route's contract masonry models list --type image masonry models params gpt-image-2 # start a pinned image job masonry image "a minimalist mountain logo, flat vector" \ --model gpt-image-2 \ --dimension 1536x1024 # use the returned ID masonry job wait <job-id> masonry job download <job-id> --output ./public/mountain-logo.png

For video, use the same job lifecycle:

Prompt

masonry models list --type video masonry models params veo-3.1-fast-generate-preview masonry video "slow dolly over a misty forest at dawn" \ --model veo-3.1-fast-generate-preview \ --aspect 16:9 masonry job wait <job-id> masonry job download <job-id> --output ./public/misty-forest.mp4

Do not assume the generation command saved a file merely because the job started. A successful submission and a downloaded artifact are two separate states.

What we verified

The installed binary identified commit 439ec95. Its top-level help exposed image, video, models, job, history, login, and init commands. The authenticated catalog returned 30 image routes and 29 video routes, not one permanent list of model names.

The generation contract was asynchronous:

  1. masonry image or masonry video submitted a job and returned an ID.
  2. masonry job status <job-id> inspected the current state.
  3. masonry job wait <job-id> blocked until the job completed or failed.
  4. masonry job download <job-id> --output <path> wrote the finished asset locally.

That separation matters in an agent workflow. If the agent writes <Image src="/hero.png" /> immediately after submission, the code may reference a file that does not exist yet. Require the download step to succeed and then verify the file before editing the component.

Ask Claude Code for the whole acceptance contract

A useful request names both the creative output and the filesystem outcome:

Generate a 1536×1024 landing-page hero with GPT Image 2. Save it to public/hero.png. Wait for the Masonry job to finish, download it, verify the file exists and opens correctly, then reference it from the page. If generation fails, report the job error and do not add a broken image path.

This prompt gives the agent five checkable responsibilities: route, dimensions, output path, failure behavior, and verification. It also keeps the code change conditional on a real artifact.

The direct shell sequence is enough; Claude Code does not need a plugin or MCP server to run it:

Prompt

masonry image "dark control room with glowing dashboards" \ --model gpt-image-2 \ --dimension 1536x1024 masonry job wait <job-id> masonry job download <job-id> --output ./public/hero.png

For a reference-led image or image-to-video job, inspect the selected route before inventing flags:

masonry models params <model>

Some routes accept --image, repeated --ref values, a seed, duration, audio controls, or a last frame. Others do not. The provider's maximum feature set and the hosted Masonry route are not necessarily identical.

The current masonry init claude-code caveat

The initializer says it creates three project-local entries under .claude/commands/:

  • generate-image-masonry.md
  • models-masonry.md
  • jobs-masonry.md

That is what appeared in our clean-directory test. The generated files were not ready to trust unchanged, however. They hard-coded ./bin/masonry, included a developer checkout location, and told Claude to default to the older imagen-3.0-generate-002 route. The CLI itself was installed elsewhere, and the live catalog contained newer routes.

Until the initializer template is corrected, use one of these safer options:

  1. Use direct commands. Ask Claude Code to run the verified masonry commands above. This requires no generated command files.
  2. Inspect and repair the generated files. Replace the hard-coded binary reference with masonry, remove machine-specific paths, replace stale model defaults with live discovery, and test one disposable output before committing the files.
  3. Do not use --force casually. masonry init claude-code --force overwrites the generated entries. Review the diff before accepting it in a project with custom commands.

Anthropic still supports existing .claude/commands files, but its current extension model also includes skills. The important question is not the folder name; it is whether the generated instructions call a real binary, discover current routes, handle asynchronous completion, and write the promised file.

Route discovery beats copied model lists

The live check returned 30 image routes and 29 video routes across generation, editing, upscaling, reference-image, lip-sync, and video-editing jobs. That count is more useful than advertising a static "50+ models" slogan, but it is still a dated observation.

Use these commands as the source of truth at execution time:

masonry models list --type image
masonry models list --type video
masonry models params <model>

Pin the model in any reproducible script. The installed image help still displayed an older default, so omitting --model can silently put the job on a route you did not evaluate.

The same rule applies to parameters. In our text-rendering run, the model parameter view advertised a provider-style --size flag, while the top-level image command rejected --size and accepted --dimension 1024x1024. Treat masonry image --help, the live route contract, and a one-file smoke test as a three-part check before a batch.

A five-minute setup acceptance test

Before asking an agent to generate production assets, verify:

CheckPass condition
Authenticationmasonry models list --type image returns the authenticated catalog without exposing a raw provider key
RouteThe exact model appears in the live list and masonry models params <model> returns its current inputs
SubmissionThe generation command returns a job ID that the agent records
Completionmasonry job wait <job-id> exits successfully or the agent reports the failure
Outputmasonry job download ... --output <path> creates the promised file at that exact path
VerificationThe agent checks file type, dimensions or duration, and a visual acceptance criterion before editing code
Cost boundaryA batch estimate uses the current route cost and expected rejection rate

One accepted test file is more valuable than a polished integration snippet that has never been executed.

Honest operating notes

  • Masonry is a hosted generation service. Jobs need network access, an authenticated account, and sufficient credits.
  • Image and video generation are asynchronous. Video commonly takes longer, but do not infer a route ranking from one queue observation.
  • There is no universal best model. Compare the same brief and acceptance sheet across current candidates.
  • Generated product imagery and embedded text still require review. A beautiful output can change a product detail, digit, or punctuation mark.
  • Keep job IDs and output paths in logs. They are the minimum audit trail for reproducing a failed asset step.

Bottom line

Claude Code can generate media without leaving the terminal when the workflow is explicit: discover a live route, start the job, wait, download to a known path, verify the asset, and only then change the code. The direct Masonry commands pass that contract today. The project initializer needs inspection before use because its current templates contain machine-specific and stale instructions.

Start with the Masonry CLI page, compare the surrounding tool choices in our Claude Code image tools guide, or move from one command to a bounded merchant batch with the Kling AI CLI product-video workflow. Use the AI image prompting guide to turn a vague creative request into a testable brief.

Share:
FAQ

Questions from this guide

Concise answers to the questions readers ask after this guide

Can Claude Code generate images?

Claude Code does not include an image generator, but it can run a media CLI. In the tested Masonry workflow, Claude starts an image or video job, captures the returned job ID, waits for completion, downloads the file into the repository, and verifies it before changing code.

How do I generate images in Claude Code from the terminal?

Run npx @masonryai/cli, authenticate with masonry login, inspect the live catalog, then run masonry image with an explicit model and dimension. The command returns a job ID; use masonry job wait and masonry job download --output to save the completed file.

What image and video models does Masonry CLI support?

The authenticated catalog returned 30 image routes and 29 video routes on August 4, 2026. Routes included GPT Image 2, Ideogram V4, FLUX.2, Nano Banana 2, Seedream 5 Pro, Veo, Kling, Seedance, Hailuo, and WAN families. Run masonry models list because names and availability change.

Should I run masonry init claude-code?

Treat it as optional and inspect the generated files before relying on them. In a clean-directory test, the current initializer created three command files but hard-coded ./bin/masonry, included a developer checkout path, and recommended an outdated Imagen 3 default. Direct masonry commands worked without the initializer.

Is Masonry CLI free?

The CLI package and account entry point do not make hosted generation free. Image and video jobs use Masonry credits. Check the selected route's current cost and estimate spend before running a batch.