From ccd35d5791162ac21c8c7055aadfbc1f81f35fcd Mon Sep 17 00:00:00 2001 From: unknown <> Date: Wed, 8 Jul 2026 17:03:45 +0000 Subject: [PATCH] docs(openrouter-images): media_type now set whenever image format is identifiable Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- skills/openrouter-images/SKILL.md | 4 ++-- skills/openrouter-images/scripts/lib.ts | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/skills/openrouter-images/SKILL.md b/skills/openrouter-images/SKILL.md index 52e1c25..92be28a 100644 --- a/skills/openrouter-images/SKILL.md +++ b/skills/openrouter-images/SKILL.md @@ -144,12 +144,12 @@ The generation cost (USD) is printed to stderr when the API reports it. When `-- Generation uses `POST /api/v1/images`. See the [Image Generation guide](https://openrouter.ai/docs/guides/overview/multimodal/image-generation) for full request/response details. -Images come back base64-encoded in a `data` array. For raster PNG output, `media_type` is omitted; vector outputs (e.g. SVG) include it, and the saved file extension follows it: +Images come back base64-encoded in a `data` array. Each entry includes `media_type` (e.g. `image/png`, `image/jpeg`, `image/webp`, `image/svg+xml`) whenever the format is identifiable; it's omitted only when the format couldn't be determined. The saved file extension follows it: ```json { "created": 1748372400, - "data": [{ "b64_json": "" }], + "data": [{ "b64_json": "", "media_type": "image/png" }], "usage": { "prompt_tokens": 0, "completion_tokens": 4175, "total_tokens": 4175, "cost": 0.04 } } ``` diff --git a/skills/openrouter-images/scripts/lib.ts b/skills/openrouter-images/scripts/lib.ts index d779802..cf91452 100644 --- a/skills/openrouter-images/scripts/lib.ts +++ b/skills/openrouter-images/scripts/lib.ts @@ -144,7 +144,8 @@ const MEDIA_TYPE_EXTENSIONS: Record = { /** * Save one base64 image. The extension follows the response `media_type` when - * present (e.g. SVG from vector models), otherwise the requested output path. + * present (set whenever the format is identifiable), otherwise the requested + * output path. */ export function saveImage(b64: string, outputBase: string, mediaType: string | undefined, index: number, total: number): string { const dotIdx = outputBase.lastIndexOf(".");