Give your coding agent an imagination.

Cosmion lets your coding agent generate images, using any image model on OpenRouter and your own API key.

npm install -g cosmion

Needs Node 22.12 or newer, on macOS, Linux or Windows.

Get started

  1. Save your key

    OpenRouter gives you one API key for AI models from many providers. Create a key, give it a spending limit, then save it.

    cosmion auth
  2. Install the skill

    This tells your agent how to use Cosmion. It works with Claude Code, Codex, OpenCode, Antigravity, Cursor, Grok Build and Copilot.

    cosmion skill install
  3. Ask your agent

    Make a 16:9 hero image of a small research dome on a rust-red plain at sunset, and save it as public/hero.png. Tell me what it will cost before you generate it.

Or run it yourself

cosmion gen "a tiny voxel space station orbiting a ringed planet, isometric" -m openai/gpt-image-2.5-sunburst
View all commands

All commands

Make

gen
Generate images, save them, and record what they cost
batch
Generate every row of a CSV or JSONL file, within a budget
regen
Run a past generation again, with the same model, prompt, settings and references

Choose

models
List the image models, or show one in full
models rank
List the models that support these options, cheapest first
price
Show what a generation will cost, without spending anything

Look back

history
List past generations, newest first
show
Show one generation in full, and whether its images are still there
usage
Show what you spent over a period, by model or by day

Set up

auth
Save your OpenRouter key, after checking it with OpenRouter
auth status
Show which key is in use, whether OpenRouter accepts it, and what it has left
auth logout
Remove the saved key
doctor
Check that Node, the key, OpenRouter and the local files are all in order
skill install
Install Cosmion's SKILL.md for your coding agents
skill update
Update Cosmion's installed skills to this version
skill uninstall
Remove Cosmion's installed skills
schema
Describe every command, option, JSON output and exit code, as JSON (for agents)

Run cosmion <command> --help for its options, or see the README. csn is the short form of cosmion.

Know what it costs

cosmion price shows what an image will cost, without spending anything. Every image's cost is recorded when it's generated, and cosmion usage totals your spending over any period.

You set the --budget for cosmion batch. It skips any image that would push the total past that limit.

Some models have no fixed price, so the cost can be unknown until the first image with those settings.

$ cosmion price \
    -m openai/gpt-image-2.5-sunburst \
    --quality high --aspect 16:9
~$0.0326

$ cosmion show w5b1cqha
Model     openai/gpt-image-2.5-sunburst
Cost      $0.0324
Settings  aspect_ratio=16:9, quality=high
Prompt    a small research dome on a
          rust-red plain at sunset,
          two moons overhead

$ 

Images made with Cosmion

Photorealistic glass research dome on a rocky red plain, with a low orange sun and two pale moons in the sky.
cosmion gen "a small research dome on a rust-red plain at sunset, two moons overhead" -m openai/gpt-image-2.5-sunburst --quality high --aspect 16:9$0.0324
Isometric space station built from small cubes, floating among blocky asteroids beside a large banded planet with rings.
cosmion gen "a tiny voxel space station orbiting a ringed planet, isometric" -m openai/gpt-image-2.5-sunburst --quality high --aspect 16:9$0.0324
Hand-painted fox in a white space suit and glass helmet, sitting on a rocky ledge and looking up at a bright comet.
cosmion gen "a fox in a space suit watching a comet, hand-painted animated film still" -m openai/gpt-image-2.5-sunburst --quality high --aspect 16:9$0.0324
Vintage travel poster headed The Ring Line, showing a sleek dark train with glowing windows curving across Saturn’s rings.
cosmion gen "a vintage travel poster for a train across Saturn's rings, with the words 'THE RING LINE'" -m openai/gpt-image-2.5-sunburst --quality high --aspect 16:9$0.0325