Skip to content

modules: author static SVG with GPT Image 2.6 (--format svg) #3784

Closed

Description

@schlessera

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, --transparent or n > 1 before any provider call.
  • Write the decoded XML as .svg with mime image/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 external href/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_usage tokens can be priced. The authoring model's rate is not published here, so it is normally unknown.
  • Do not send the svg model-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 svg sends output_format:"svg" and no n above 1, and writes the decoded XML to a .svg path.
  • 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 null when svg_usage cannot 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/main

Keyless and offline only.

Contract impact

The --json envelopes are unchanged. This is additive CLI behaviour, shipped as a minor changeset.

Activity

  1. added
    type: feat
    area: modules
    priority: p2
    agent-ready
    blocked
    on Nov 9, 2026
  2. schlessera commented on Nov 10, 2026

    @schlessera
    OwnerAuthor

    Unblocked: #3782 is closed, so scripts/sync-project.ts is removing the blocked label.

  3. removed
    blocked
    on Nov 10, 2026
  4. self-assigned this
    on Nov 10, 2026
  5. schlessera commented on Nov 10, 2026

    @schlessera
    OwnerAuthor

    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.

  6. added this to the 0.45.0 milestone on Nov 11, 2026
  7. schlessera commented on Nov 11, 2026

    @schlessera
    OwnerAuthor

    Delivered by #3969, squashed onto main as 38aeb5fd34d529ee769622eacdbca3679926e512 (milestone 0.45.0). Every acceptance criterion is covered by offline tests in packages/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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

agent-readyarea: modulespriority: p2type: feat

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions