generate-image – skill Thiết kế & UI cho agent AI
Tạo hoặc chỉnh sửa hình ảnh bằng mô hình AI qua OpenRouter Image API (Gemini, Seedream, Recraft, GPT-Image, Riverflow). Dùng cho ảnh chụp, minh họa, tác phẩm nghệ thuật, concept art, tài sản hình ảnh, logo, và chỉnh sửa hoặc ghép ảnh từ ảnh tham chiếu. Với sơ đồ luồng, mạch điện, đường đi sinh học và các sơ đồ kỹ thuật khác
Cài skill generate-image bằng một lệnh
Chọn công cụ bạn đang dùng, copy lệnh và dán vào terminal. Skill sẽ nằm trong thư mục skills của công cụ đó và sẵn sàng dùng ở phiên làm việc tiếp theo.
Claude Code
mkdir -p ~/.claude/skills && curl -fsSL https://skill.dn1nguoi.com/z/generate-image-02d4e.tgz | tar xz -C ~/.claude/skills
Gọi trong Claude Code: /generate-image – rồi mô tả công việc bạn muốn làm.
Codex
mkdir -p ~/.codex/skills && curl -fsSL https://skill.dn1nguoi.com/z/generate-image-02d4e.tgz | tar xz -C ~/.codex/skills
Gọi trong Codex: $generate-image – rồi mô tả công việc bạn muốn làm.
Hermes Agent
mkdir -p ~/.hermes/skills && curl -fsSL https://skill.dn1nguoi.com/z/generate-image-02d4e.tgz | tar xz -C ~/.hermes/skills
Gọi trong Hermes Agent: /generate-image – rồi mô tả công việc bạn muốn làm.
DeepSeek
mkdir -p ~/.deepcode/skills && curl -fsSL https://skill.dn1nguoi.com/z/generate-image-02d4e.tgz | tar xz -C ~/.deepcode/skills
Gọi trong DeepSeek: /generate-image – rồi mô tả công việc bạn muốn làm.
Nội dung SKILL.md
Nội dung SKILL.md gốc bằng tiếng Anh.
Generate Image
Generate and edit images through OpenRouter's Image API, which reaches Gemini, Seedream, Recraft,
GPT-Image, Riverflow, and 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
# 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.pngRun these commands from the skill directory; input and output paths resolve from the working
directory. Output defaults to generated_image.<ext>, using each image's returned media type
(or .bin when unknown). An explicit output suffix is kept, with a warning on mismatch; the
script does not transcode. OpenRouter and upstream costs are printed separately when supplied.
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.
| Need | Model |
| --- | --- |
| General quality, prompt adherence | google/gemini-3.1-flash-image |
| Highest Gemini tier | google/gemini-3-pro-image |
| Cheap iteration | google/gemini-3.1-flash-lite-image (1K only), openai/gpt-image-1-mini |
| Photoreal control, seeded generation | bytedance-seed/seedream-4.5 |
| Several images per request | bytedance-seed/seedream-4.5, openai/gpt-image-2 (up to 10) |
| Vector / SVG output | recraft/recraft-v4.1-vector |
| Transparent background | openai/gpt-image-1 with --background transparent |
| Legible text inside the image | recraft/recraft-v4.1, sourceful/riverflow-v2.5-pro — see the caveat below |
[references/models.md](references/models.md) carries the reviewed capability and pricing snapshot. The live listing is authoritative and free:
python scripts/generate_image.py --list-models # every model and its allowed values
python scripts/generate_image.py --list-models gemini # filtered by substring
python scripts/generate_image.py --model-info openai/gpt-image-1 # one model, plus pricingParameter support varies by model
This is the main thing to get right. Models advertise different parameter sets **and different
allowed values**. The CLI conservatively rejects unadvertised options; individual providers may
ignore or normalize some fields. The generic guide can lag the discovery records.
The script checks the model catalogue and requires at least one provider endpoint to accept the
complete combination before generation. Model capabilities are a union across endpoints, not a
promise that every provider supports them. Unsupported requests fail locally with legal values:
$ python scripts/generate_image.py "abstract pattern" -m openai/gpt-image-2 --background transparent
Error: Request rejected before billing (1 problem):
- background=transparent is not allowed; this model accepts: auto, opaqueCurrent examples of capability differences (reviewed 2026-09-30):
--resolution: Gemini 3.1 Flash accepts512,1K,2K,4K; Flash Lite and Krea
accept only 1K. Seedream 5.0 Lite accepts 2K/4K, while 5.0 Pro accepts 1K/2K.
--output-format: Riverflow 2.5 Pro acceptspng/jpeg/webp; its Fast variant accepts
only jpeg. Recraft vector models accept svg. OpenAI models do not advertise this flag.
--quality: GPT Image 2.5 Flare/Sunburst also acceptxhigh/max; Grok 2.0 accepts
only low/medium. Inspect the specific model before selecting a quality value.
--background transparentis not available ongpt-image-2orgpt-5.4-image-2.
It is advertised on GPT Image 1 and 2.5. Do not combine transparency with JPEG; when no
output format is selectable, inspect the returned file for an actual alpha channel.
--aspect-ratio: GPT-5 Image and Mini now accept1:1,3:2,2:3,auto;
GPT-5.4 Image 2 also accepts wider ratios. None accept a resolution flag in this snapshot.
--nis an upper bound, not a guarantee: providers may return fewer images. Seedream 4.5
caps at 10, Seedream 5.0 Lite at 4, and 5.0 Pro at 1. Krea does not advertise n.
--seedis available on Seedream, Krea, Qwen and FLUX, but not Gemini or OpenAI.
Keep the model/provider, prompt and parameters fixed; a seed is not a cross-version guarantee.
--dry-run performs free discovery and prints the request without generating. If discovery
fails, the command stops; --no-preflight explicitly bypasses it. Combining both flags is an
offline payload inspection, not validation of provider support.
Writing the prompt
Prompt quality decides output quality more than model choice does. Name, in one sentence each:
1. Subject — what is in frame, and how much of it. "A single pipette tip above a 96-well plate."
2. Medium and style — photograph, watercolour, 3D render, flat vector, scientific illustration.
3. Lighting and palette — "soft diffuse lighting, cool blue and white palette."
4. Composition — "wide shot, subject left of centre, empty space on the right for a title."
5. What to avoid — "no text, no labels, no watermark."
Asking for empty space where a caption or title will go is the single most useful compositional
instruction for posters and slides.
Iterate cheaply: draft on gemini-3.1-flash-lite-image, then regenerate the wording you settled on
with the model you actually want. To refine rather than restart, feed the last output back as a
reference (-i out.png) and describe only the change.
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.
# 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.jpgReference ranges include both a minimum and a maximum: OpenAI accepts up to 16, Gemini 3 and
Seedream up to 14, Riverflow Pro up to 10, and MAI 2.6 up to 5. Recraft v4 Styles requires
1–10 references; its regular v4/v4.1 models accept 0–1. Ming Design Layer requires exactly one,
while Ming Design and Recraft Flash are text-only. The CLI checks required and zero-reference
limits too. Local formats supported by the helper: PNG, JPEG, GIF, WebP; provider decoding rules
still apply. Local files and data URLs send their bytes; URL references are fetched by the service.
Do not use private or credential-bearing URLs. Riverflow v2 bills $0.20 per reference image.
Worked examples
The -o paths are destinations the script creates, not bundled files. These are generation
examples, not authenticated end-to-end results from this review. Their request parameters were
checked against public discovery, and local encoding/response handling was tested with mocks.
# Wide hero image for a poster, with space reserved for the title
python scripts/generate_image.py \
"Laboratory with modern equipment, photorealistic, well-lit, wide shot, \
equipment on the left, empty wall on the right, no text" \
--aspect-ratio 21:9 --resolution 2K -o poster/hero.png
# Conceptual illustration for a manuscript — illustrative, never presented as data
python scripts/generate_image.py \
"Stylised illustration of immune cells surrounding a tumour cell, scientific illustration, \
cool palette, no text" \
--resolution 2K -o figures/immunotherapy_concept.png
# Vector logo
python scripts/generate_image.py \
"Minimal geometric fox logo, two colors" \
-m recraft/recraft-v4.1-vector --output-format svg -o assets/logo.svg
# Slide background with a transparent alpha channel
python scripts/generate_image.py \
"Abstract molecular pattern, subtle, blue and white, no text" \
-m openai/gpt-image-1 --background transparent -o slides/bg.png
# Four variations in one request
python scripts/generate_image.py \
"Stylized neuron network ill… (nội dung đầy đủ có trong gói tải về)
Skill liên quan
- event-store-design – Thiết kế và triển khai event store cho hệ thống event-sourced. Dùng khi xây dựng hạ tầng…
- hunt-dom – Săn lỗ hổng DOM phía client — DOM Clobbering (ghi đè biến JS toàn cục qua chèn HTML)…
- design-md – Soạn thảo, kiểm tra và xuất các tệp token spec DESIGN.md của Google.
- application-performance-performance-optimization – Tối ưu hiệu năng ứng dụng toàn diện với profiling, observability và tinh chỉnh…
- hunt-file-upload – Săn lỗi upload file — RCE qua webshell, XSS qua SVG/HTML, SSRF qua XXE trong DOCX, path…
- chro-advisor – Lãnh đạo nhân sự cho công ty đang mở rộng. Chiến lược tuyển dụng, thiết kế lương thưởng…
- hunt-http-smuggling – Săn HTTP request smuggling (CL.TE, TE.CL, H2.CL, H2.TE). Nguyên nhân: proxy phía trước…
- churn-prevention – Giảm churn tự nguyện và không tự nguyện thông qua thiết kế luồng hủy, ưu đãi giữ chân…