Repository navigation
Description
Context
GPT Image 2.6 can author SVG: output_format: "svg" on POST /v1/images/generations only, with n: 1 and no streaming or compression. The API renders a reference image first (controlled by quality/complexity), then an authoring model writes the SVG. The result is UTF-8 XML in data[0].b64_json. Authoring tokens are billed at the authoring model's rate and reported separately in svg_usage. The guide says the output is static, with no scripts, external resources or embedded raster images. The optional svg object ({model, reasoning}) requires separate access to SVG model selection. Sources are in #3781 and were checked 2026-11-09.
The module's formats are raster-only (FORMATS, packages/module-images/src/cli.ts:35; decode, packages/module-images/src/providers/openai.ts:220-238, which builds image/${format}).
Blocked by #3782
Scope
- Add
--format svg, served only by the 2.6 pair, on generation only. Refuse it with--ref,--mask,--transparentor n > 1 before any provider call. - Write the decoded XML as
.svgwith mimeimage/svg+xml. - Treat the vendor's static-output statement as a claim, not a guarantee. Before writing, refuse to keep an SVG containing
<script>, event-handler attributes,<foreignObject>or externalhref/xlink:href/url()references. Reuse the static-resource validation the renderer already applies to local markdown SVGs if one exists; otherwise add a narrow check in this module. - Report the cost as unknown unless both the image tokens and the
svg_usagetokens can be priced. The authoring model's rate is not published here, so it is normally unknown. - Do not send the
svgmodel-selection object. It needs access that cannot be verified. - Update help, README, skill and changeset.
Out of scope
SVG editing and SVG as an input. Selecting the authoring model or its reasoning effort. Rasterising the SVG.
Acceptance criteria
- An offline stub shows
--format svgsendsoutput_format:"svg"and nonabove 1, and writes the decoded XML to a.svgpath. - SVG with
--ref,--mask,--transparent, Gemini or a 2.5 model refuses with zero fetch calls. - A stubbed SVG response containing a script, an event handler or an external reference is refused and nothing is written. A clean one is written.
- The cost is
nullwhensvg_usagecannot be priced. - Failing-first receipts and a restored mutation of the active-content guard.
Verification
bun run test packages/module-images
bun run typecheck
bun run lint
bun run check:pr --base origin/mainKeyless and offline only.
Contract impact
The --json envelopes are unchanged. This is additive CLI behaviour, shipped as a minor changeset.
Activity
schlessera commentedon Nov 10, 2026
Unblocked: #3782 is closed, so
scripts/sync-project.tsis removing theblockedlabel.schlessera commentedon Nov 10, 2026
Claimed for implementation. Claim token:
claim-b18c1e64. Branch:feat/3784-image-svg.Builds on the GIF change in #3868 (same image-module files); the PR opens once #3868 lands.
fix(images): spell the SVG byte-order mark as an escape (#3784)
feat(images): static SVG from GPT Image 2.6 with --format svg, refusi…
schlessera commentedon Nov 11, 2026
Delivered by #3969, squashed onto main as
38aeb5fd34d529ee769622eacdbca3679926e512(milestone 0.45.0). Every acceptance criterion is covered by offline tests inpackages/module-images; the failing-first receipt and the active-content-guard mutation are in the PR body. The static-SVG check has only been exercised against stubbed responses, since no live call was made.