Files
scientific-agent-skills/skills/generate-image/scripts
Timothy Kassis 3f530cf49e Update generate-image for the OpenRouter Image API
The skill called /api/v1/chat/completions with modalities: ["image","text"],
which reaches only 11 models. Both FLUX models the skill documented as options
are not among them, so those paths returned 404 "No endpoints found that
support the requested output modalities". Move to POST /api/v1/images, which
serves the full 38-model image catalogue.

- Parse data[].b64_json and media_type instead of
  choices[].message.images[].image_url.url; output extension now follows the
  returned media type, so vector models write .svg correctly.
- Send reference images as input_references; -i is repeatable for compositing.
- Add --n, --aspect-ratio, --resolution, --size, --quality, --output-format,
  --background, --output-compression, --seed, --timeout, --list-models.
- Omit unset parameters. Models reject unsupported parameters rather than
  ignoring them, so a fixed parameter set breaks most of the catalogue.
- Fix API key resolution: check_env_file() only read .env files, so the
  documented `export OPENROUTER_API_KEY=...` never worked. Order is now
  --api-key, environment, .env.
- Default to google/gemini-3.1-flash-image (GA) rather than the preview slug.
- Drop the requests dependency for stdlib urllib.

Add references/models.md with per-model parameter support, reference-image
limits, and n caps. Add tests/generate-image/ with 27 network-free tests.

Verified against the live API: default model at 16:9, flux.2-pro with --seed
and --output-format, and an -i edit all produce correct images; --list-models
returns 38 models without a key.
2026-07-26 15:48:58 -07:00
..