Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions skills/openrouter-images/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -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": "<base64-encoded image data>" }],
"data": [{ "b64_json": "<base64-encoded image data>", "media_type": "image/png" }],
"usage": { "prompt_tokens": 0, "completion_tokens": 4175, "total_tokens": 4175, "cost": 0.04 }
}
```
Expand Down
3 changes: 2 additions & 1 deletion skills/openrouter-images/scripts/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ const MEDIA_TYPE_EXTENSIONS: Record<string, string> = {

/**
* 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(".");
Expand Down