# Generate Image

Generate or edit images with AI models through the OpenRouter Image API (Gemini...

- Repository: https://github.com/K-Dense-AI/claude-scientific-writer (2545 stars)
- Category: Data and ML
- License: MIT
- Last updated: 2026-10-31
- Runs scripts: yes, review before use

## Install

Claude Code: `npx skills add K-Dense-AI/claude-scientific-writer --skill generate-image -g -a claude-code -y`
Codex: `npx skills add K-Dense-AI/claude-scientific-writer --skill generate-image -g -a codex -y`
Cursor: `npx skills add K-Dense-AI/claude-scientific-writer --skill generate-image -g -a cursor -y`
Gemini CLI: `npx skills add K-Dense-AI/claude-scientific-writer --skill generate-image -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add K-Dense-AI/claude-scientific-writer`

## Description

Generate or edit images with AI models through the OpenRouter Image API (Gemini, Seedream, Recraft, GPT-Image, Riverflow). Use for photos, illustrations, artwork, concept art, visual assets, logos, and image editing or compositing from reference images. For flowcharts, circuits, pathways, and other technical diagrams, use the scientific-schematics skill instead.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Generate Image

Generate and edit images through OpenRouter's Image API, which reaches Gemini, Seedream, Recraft,
GPT-Image, Riverflow, and roughly thirty other models behind one request shape.

## When to use

**Use this skill for:** photos and photorealistic images, illustrations and artwork, concept art,
presentation and poster visuals, logos and vector marks, image editing, and compositing from
reference images.

**Use `scientific-schematics` instead for:** flowcharts, circuit diagrams, biological pathways,
system architecture diagrams, CONSORT diagrams, and other technical schematics.

## API key

Generation requires an OpenRouter key. The script resolves it in this order:

1. `--api-key`
2. the `OPENROUTER_API_KEY` environment variable
3. `OPENROUTER_API_KEY=` in a `.env` file, searching the working directory upward, then the
   script's own directory

If none is present the script exits with setup instructions. Keys: https://openrouter.ai/keys

`--list-models`, `--model-info`, and `--dry-run` need no key.

## Quick start

```bash
# Generate
python scripts/generate_image.py "A beautiful sunset over mountains"

# Edit an existing image
python scripts/generate_image.py "Make the sky purple" -i photo.jpg -o edited.png
```

Paths are relative to this skill's directory. Output defaults to `generated_image.<ext>`, where the
extension follows the media type the model returned. The per-request cost is printed after the run.

**Then look at the image.** Read the file back and check it before using it anywhere: composition,
aspect ratio, and any text are all things models get wrong silently.

## Choosing a model

Default: `google/gemini-3.1-flash-image`.

The rest: https://github.com/K-Dense-AI/claude-scientific-writer/blob/HEAD/.claude/skills/generate-image/SKILL.md
