Generate Image logo

Generate Image

OrganizationPopular
K-Dense-AI
generate-image

Generate or edit images with AI models through the OpenRouter Image API (Gemini, FLUX, Seedream, Recraft, GPT-Image). 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.

Overview

PublisherK-Dense-AI
Repositoryclaude-scientific-writer
Skill namegenerate-image
Stars
2.4K
Forks
273
Bundled files
2
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 2 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by K-Dense-AI on GitHub. Read the source before you install it.

Installation

Install the Generate Image AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/K-Dense-AI/claude-scientific-writer.git /tmp/claude-scientific-writer
mkdir -p .claude/skills
cp -r /tmp/claude-scientific-writer/skills/generate-image .claude/skills/generate-image
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Generate Image in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Generate Image on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Generate Image is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Generate Image

Generate and edit images through OpenRouter's Image API, which reaches Gemini, FLUX, Seedream, Recraft, GPT-Image, 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

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

--list-models needs 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

Output defaults to generated_image.<ext>, where the extension follows the media type the model returned. The per-request cost is printed from usage.cost.

Choosing a model

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

NeedModel
General quality, prompt adherencegoogle/gemini-3.1-flash-image
Highest Gemini tiergoogle/gemini-3-pro-image
Photoreal control, reproducible seedsblack-forest-labs/flux.2-pro
Cheap iterationblack-forest-labs/flux.2-klein-4b
Several images per requestbytedance-seed/seedream-4.5, openai/gpt-image-2
Vector / SVG outputrecraft/recraft-v4-vector
Transparent backgroundopenai/gpt-image-2 with --background transparent

references/models.md carries the full catalogue with per-model parameter support. The live listing is authoritative:

bash
python scripts/generate_image.py --list-models

Parameter support varies by model

This is the main thing to get right. Models advertise different parameter sets, and sending a parameter a model does not support is rejected, not ignored. The script omits every flag you do not pass, so pass only what the target model accepts.

  • --resolution (512, 1K, 2K, 4K) — Gemini, Seedream, Riverflow, Krea, Grok. Not FLUX.
  • --output-format — FLUX and Riverflow 2.5. Not Gemini.
  • --quality, --background, --output-compression — the OpenAI family.
  • --seed — FLUX, Seedream, Krea. Not Gemini, not OpenAI.
  • --aspect-ratio — nearly all models, but the allowed enum differs.
  • --n — capped per model: 1 for Gemini and FLUX, 6 for Recraft, 10 for Seedream and OpenAI.

On an HTTP 400 the script prints OpenRouter's message and points at --list-models.

Editing and reference images

-i/--input is repeatable and accepts local paths, HTTP(S) URLs, or data URLs. Local files are base64-encoded and sent as input_references.

bash
# Single-image edit
python scripts/generate_image.py "Add sunglasses to the person" -i portrait.png

# Composite several references
python scripts/generate_image.py "Blend these two styles" -i style_a.png -i style_b.jpg -o blend.png

# Reference an image already on the web
python scripts/generate_image.py "Restyle as a watercolor" -i https://example.com/photo.jpg

Reference limits differ: 16 for OpenAI, 14 for Gemini and Seedream, 8 for FLUX, 1 for Recraft and MAI. Accepted local formats: PNG, JPEG, GIF, WebP.

Worked examples

bash
# Wide hero image for a poster
python scripts/generate_image.py \
  "Laboratory with modern equipment, photorealistic, well-lit" \
  -m black-forest-labs/flux.2-pro --aspect-ratio 21:9 -o poster/hero.png

# Conceptual figure for a manuscript
python scripts/generate_image.py \
  "Microscopic view of cancer cells attacked by immunotherapy agents, scientific illustration" \
  --resolution 2K -o figures/immunotherapy_concept.png

# Vector logo
python scripts/generate_image.py \
  "Minimal geometric fox logo, two colors" \
  -m recraft/recraft-v4-vector -o assets/logo.svg

# Slide background with a transparent alpha channel
python scripts/generate_image.py \
  "Abstract molecular pattern, subtle, blue and white" \
  -m openai/gpt-image-2 --background transparent -o slides/bg.png

# Four variations in one request
python scripts/generate_image.py \
  "Stylized neuron network illustration" \
  -m bytedance-seed/seedream-4.5 --n 4 -o variations.png
# -> variations_1.png ... variations_4.png

# Reproducible output
python scripts/generate_image.py "A cat astronaut" \
  -m black-forest-labs/flux.2-pro --seed 42

Script parameters

FlagPurpose
promptImage description, or the edit to apply (required unless --list-models)
-m, --modelModel slug (default google/gemini-3.1-flash-image)
-o, --outputOutput path; extension defaults to the returned media type
-i, --inputReference image — path, URL, or data URL. Repeatable
--nImages per request, model-capped
--aspect-ratio1:1, 16:9, 9:16, 4:3, 3:2, 21:9, …
--resolution512, 1K, 2K, 4K
--sizeExplicit pixels, e.g. 2048x2048
--qualityauto, low, medium, high
--output-formatpng, jpeg, webp, svg
--backgroundauto, transparent, opaque
--output-compression0–100, for WebP/JPEG
--seedDeterministic output where supported
--api-keyOverrides the environment and .env
--timeoutRequest timeout, seconds (default 300)
--list-modelsPrint the catalogue with parameter support, then exit

API shape

For direct requests without the script:

bash
curl -s https://openrouter.ai/api/v1/images \
  -H "Authorization: Bearer $OPENROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "google/gemini-3.1-flash-image",
    "prompt": "A red bicycle against a white wall",
    "aspect_ratio": "16:9"
  }'

Response:

json
{
  "created": 1748372400,
  "data": [{ "b64_json": "<base64>", "media_type": "image/png" }],
  "usage": { "prompt_tokens": 0, "completion_tokens": 4175, "total_tokens": 4175, "cost": 0.04 }
}

b64_json is raw base64, not a data URL. media_type reflects the real format, so honour it when naming files — vector models return image/svg+xml.

Streaming ("stream": true) emits image_generation.partial_image, image_generation.completed, and error events, terminating with data: [DONE]. Only the OpenAI models support it, and the bundled script does not use it.

Billing is all-or-nothing: a generation is either completed and billed in full, or it fails and is not billed. Streaming preview frames are not charged separately.

Notes and caveats

  • Generation is a paid API call. Prefer a cheap model while iterating on a prompt.
  • Generation takes roughly 5–60 seconds depending on model and resolution.
  • Reference images are uploaded to OpenRouter. Do not send unpublished or sensitive data.
  • Never hardcode the API key. Keep it in the environment or an ignored .env.
  • Prompt specifically when editing: "change the sky to sunset colours" beats "edit the sky".

Related skills

  • scientific-schematics — technical diagrams, flowcharts, circuits, pathways
  • scientific-slides — presentations that embed generated visuals
  • latex-posters — posters that embed hero images

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Generate Image AI skill do?

Generate or edit images with AI models through the OpenRouter Image API (Gemini, FLUX, Seedream, Recraft, GPT-Image). 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.

Why use Generate Image on TypingMind?

Because you install it once and use it with any model. Generate Image is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Generate Image in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/K-Dense-AI/claude-scientific-writer/tree/main/skills/generate-image. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Generate Image?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Generate Image?

As many as you like. As long as a model supports skills, you can use Generate Image with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Generate Image AI skill free?

Yes. It is published on GitHub by K-Dense-AI under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇