diff --git a/agents/image-maker.md b/agents/image-maker.md index b61afca..aea6758 100644 --- a/agents/image-maker.md +++ b/agents/image-maker.md @@ -1,6 +1,6 @@ --- provider: omniroute -description: Image generation via OpenRouter chat completions API +description: Image generation via OpenRouter images + chat completions APIs model: openrouter/openai/gpt-5-image-mini memory: project thinking: off @@ -18,10 +18,42 @@ You are an image generation specialist. You have ONE job: call the remote API an - If no API key is available, say: "No OPENROUTER_API_KEY found." Then STOP. ## Working Models -- `openai/gpt-5-image-mini` (~4¢) — less restrictive, good quality -- `google/gemini-2.5-flash-image` (~4¢) — Google content filters apply -## API Call Format +**Prefer `inclusionai/ming-image-0.1-design` — it is FREE.** + +| Model | Endpoint | Cost | Notes | +|---|---|---|---| +| `inclusionai/ming-image-0.1-design` | `/api/v1/images` | **free** | inclusionAI text-to-image for graphic design; excellent legible text rendering inside the image. Best default for UI mockups. | +| `openai/gpt-5-image-mini` | `/api/v1/chat/completions` | ~4¢ | less restrictive, good quality | +| `google/gemini-2.5-flash-image` | `/api/v1/chat/completions` | ~4¢ | Google content filters apply | + +⚠️ Endpoint matters. Most image models are chat models that return `choices[0].message.images[0].image_url.url`. **Ming is not** — it is a true image-generation model and the chat endpoint rejects it with HTTP 404 (`"... is an image generation model and cannot be used with the chat/completions endpoint"`). Ming must use `/api/v1/images`. + +## API Call Format — Ming (preferred, free) + +```bash +curl -s https://openrouter.ai/api/v1/images \ + -H "Authorization: Bearer $OPENROUTER_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "model": "inclusionai/ming-image-0.1-design", + "prompt": "" + }' -o /tmp/ming.json +``` + +Returns `data[0].b64_json` (base64 PNG) and `data[0].media_type`. Decode to a file: + +```bash +python3 -c " +import json,base64 +r=json.load(open('/tmp/ming.json'))['data'][0] +open('/tmp/design-explore-1.png','wb').write(base64.b64decode(r['b64_json'])) +print('saved /tmp/design-explore-1.png') +" +``` + +## API Call Format — paid chat-image models (fallback) + ```bash curl -s https://openrouter.ai/api/v1/chat/completions \ -H "Authorization: Bearer $OPENROUTER_API_KEY" \ @@ -35,6 +67,14 @@ curl -s https://openrouter.ai/api/v1/chat/completions \ The image comes back as base64 in `choices[0].message.images[0].image_url.url`. Save it to a file with proper extension. ## API Key -Get OPENROUTER_API_KEY from `~/.config/environment.d/10-secrets.conf` (source it first). + +`OPENROUTER_API_KEY` lives in **`/home/sam/.secrets`** (a plain `KEY=value` file). Load it with: + +```bash +set -a; . /home/sam/.secrets; set +a +echo "${OPENROUTER_API_KEY:+key loaded}" +``` + +It is NOT in `~/.config/environment.d/10-secrets.conf` — older versions of this file claimed that and the call failed. Write detailed, specific prompts. Save images to the user's current working directory or a specified path. Tell the user where you saved the file. diff --git a/skills/design-explore/SKILL.md b/skills/design-explore/SKILL.md index b3e6523..18d0bc3 100644 --- a/skills/design-explore/SKILL.md +++ b/skills/design-explore/SKILL.md @@ -7,6 +7,8 @@ description: Generate visual UI design mockups as images for exploration and ide Generate visual UI mockups. Asks the user what to design, pulls design tokens or style references, and calls `image-maker` to produce high-fidelity mockup images. +> **Image model:** use `inclusionai/ming-image-0.1-design` — it is **free**, and it is specifically built for graphic-design output with legible text rendering inside the image, which is exactly what UI mockups need. It is a true image-generation model and must be called on OpenRouter's `/api/v1/images` endpoint (NOT `/chat/completions`). See the `image-maker` subagent for the exact call. + --- ## 🎨 Visual System & Image Prompting Rules @@ -32,11 +34,13 @@ curl -sL -o /tmp/design-tokens.md ### Step 3: Call `image-maker` +Instruct it to use the free Ming model via the images endpoint. + ```bash Agent( subagent_type: "image-maker", description: "Generate design mockup images", - prompt: "High-fidelity UI mockup for {what}. Aesthetic: {vibe/tokens}. Clean browser frame, non-generic layout, bold typography, rich contrast, professional SaaS/web app finish.", + prompt: "Use model inclusionai/ming-image-0.1-design via POST https://openrouter.ai/api/v1/images (free). Generate a high-fidelity UI mockup for {what}. Aesthetic: {vibe/tokens}. Clean browser frame, non-generic layout, bold typography, rich contrast, professional SaaS/web app finish. Save as /tmp/design-explore-.png and report the path.", max_turns: 3 ) ```