Create image
create_imageGenerate or edit AI images, save them to your project, and receive inline previews with cost.
Instructions
Generate or edit image(s) via OpenRouter and save them into the project, returning the image inline in chat plus the saved paths and the measured cost. MANDATORY FIRST STEP: the prompt must be written with the bundled 'image' skill — each model needs its own prompt syntax, and Seedream in particular treats comma-separated tags as an anti-pattern. The tool refuses to generate when the skill is missing from the project (it installs it and tells you to read .claude/skills/image/SKILL.md from disk, then call again) or when prompt_source is empty. Default model is Seedream 4.5: $0.04 flat, up to 7.5MP, best prompt adherence — control framing with aspect_ratio and do NOT pass size (that only lowers the resolution for the same price). Seedream covers essentially every task; read the model description before picking anything else, it carries a measured decision table. EDITING: pass the source image via reference_images (local paths or URLs) plus an instruction in the prompt ('remove the sign', 'make the background lighter'); every image model here accepts image input. Name what must stay unchanged explicitly ('keeping its pose unchanged') — that is the vendor-documented way to avoid drift. Mask-based inpainting is NOT supported by this endpoint. Sizing is model-specific: Seedream takes aspect_ratio alone; Gemini needs aspect_ratio + resolution:'2K'. Files land in save_dir (default ./generated, relative to the project). AFTER GENERATING: raw output here is full-resolution and the wrong format for production — run optimize_images on save_dir before shipping (resize/webp/srcset). In a landing build (create_website kind='landing') this is the mandatory last step of the image stage: generate the whole series first (hero → reference_images for the rest, same 'photoshoot'), then one optimize_images call on assets/img at the end — never optimize between individual generations. Requires OPENROUTER_API_KEY in the server .env.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| n | No | Number of images (default 1). Not every model supports n>1. | |
| seed | No | Seed for reproducible output (provider-dependent). | |
| size | No | Explicit pixel size, '<width>x<height>'. Seedream only, and ONLY when an exact pixel size is genuinely required — it costs $0.04 either way, so passing 'size' just LOWERS what you get (e.g. '2560x1440' = 3.7MP vs 7.5MP with aspect_ratio alone). Prefer aspect_ratio. Minimum 3686400 px; the model rejects anything smaller. | |
| model | No | OpenRouter image model. All numbers below are MEASURED usage.cost and measured pixels, not estimates. DEFAULT — bytedance-seed/seedream-4.5: use it unless a rule below says otherwise. $0.04 flat at ANY size, best prompt adherence, best editing consistency, best $/MP. Sizing: pass aspect_ratio and DO NOT pass 'size' — without 'size' it returns its maximum (3642x2048 = 7.5MP at 16:9; 2048x2048 = 4.2MP at 1:1) for the same $0.04. That is ~$0.005/MP. Passing 'size' only ever LOWERS the resolution for the same price. This list is cost guidance, not a capability map: every model here handles any subject competently, and seedream's 7.5MP already exceeds any web/screen need. Each rule below names the one edge where that model beats seedream by enough to justify costing 2.5-3.4x more per frame — no edge in the frame, no reason to pay the premium. An explicit user request for a specific model overrides these rules. • Close-up skin texture where pores/hairs genuinely carry the shot → google/gemini-3.1-flash-image with resolution:'2K' ($0.101, 2752x1536 = 4.2MP). Best skin fidelity of any model here; seedream is cleaner but its skin reads slightly 'rendered'. Also the ONLY model with banner-strip ratios (1:4, 4:1, 1:8, 8:1). • Hardest scenes only (many interacting subjects, tricky physics) → google/gemini-3-pro-image with resolution:'2K' ($0.137). ~6x seedream per pixel — not a general 'better' button. ALWAYS pass resolution:'2K' on either Gemini. Omitting it silently defaults to '1K' (1376x768 = 1.1MP for $0.069 on flash) — the worst $/MP of any option here. On gemini-3-pro-image '1K' and '2K' cost the SAME ($0.135 vs $0.137, both 1120 image tokens), so asking pro for '1K' is a pure loss. '4K' exists on both Gemini models (5504x3072 = 16.9MP) but costs 50-75% more ($0.153 flash / $0.242 pro). 16.9MP is print territory — do NOT use it for web work. Deliberately not listed: OpenAI image models and google/gemini-3.1-flash-lite-image — both failed our quality tests. | |
| prompt | Yes | What to generate. ОБЯЗАТЕЛЬНО собери его скиллом 'image' — у каждой модели свой синтаксис промпта. Тул откажет, если скилла нет в проекте или не заполнен prompt_source. | |
| filename | No | Base filename (extension added automatically). Default: slug of the prompt + timestamp. | |
| save_dir | No | Where to save (absolute, or relative to the project cwd). Default: ./generated. | |
| resolution | No | Resolution tier: '2K' (use this) or '4K' (print only — 50-75% dearer for pixels web can't use). Gemini only; do not pass it with Seedream, which has no tiers and always returns its max. MANDATORY on Gemini — omitting it defaults to '1K', which is the worst $/MP on every model that offers it (flash: 1.1MP for $0.069; and on gemini-3-pro-image '1K' costs the same as '2K' for a quarter of the pixels). | |
| aspect_ratio | No | Aspect ratio, e.g. '16:9', '1:1', '9:16'. Works on every listed model, including Seedream. This is the PREFERRED way to control framing — on Seedream it also maximises resolution for free (16:9 -> 7.5MP vs 4.2MP for 1:1, same $0.04). | |
| project_path | No | Project root where the 'image' prompt skill is checked/installed. Default: the server cwd. | |
| output_format | No | Output format. Provider-dependent; default is the model's own. | |
| prompt_source | Yes | ОБЯЗАТЕЛЬНО. Какой раздел скилла 'image' использован при составлении промпта — например 'SKILL.md → Seedream' или 'references/gemini.md'. Заполняй только если ты действительно прочитал гайд и собрал промпт по нему: промпт «из головы» здесь не принимается — у каждой модели свой синтаксис, и без гайда кадр выходит шаблонным, а деньги тратятся впустую. | |
| reference_images | No | Reference images for image-to-image / style anchoring: local file paths (png/jpg/webp; absolute or relative to the project) or http(s) URLs. E.g. pass an approved hero image to keep a series stylistically consistent. Max 16 (provider-dependent). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cost | No | Total cost in USD, when reported. | |
| count | Yes | ||
| model | Yes | The model that ran. | |
| paths | Yes | Absolute paths of the saved image files. | |
| save_dir | Yes |