Skip to content

feat(images): animated GIFs from GPT Image 2.6 with --format gif, --frames and --frame-duration (#3783) - #3868

Merged
schlessera merged 9 commits into
mainfrom
feat/3783-image-gif
Nov 11, 2026
Merged

schlessera merged 9 commits into
mainfrom
feat/3783-image-gif

Conversation

@schlessera

@schlessera schlessera commented Nov 10, 2026 •

Copy link
Copy Markdown
Owner

Closes #3783. Part of #3781.

What changed

  • brain image --format gif asks a GPT Image 2.6 model (gpt-image-2.6-sunburst by default, or gpt-image-2.6-flare) for an animated GIF, as a new image or as an edit with --ref. The bytes are written to a .gif path with mime image/gif.
  • --frames <2-16> and --frame-duration <20-2000 ms> are sent as frame_count and frame_duration_ms, on both the JSON generation and the multipart edit. Without them nothing is sent, and the API's own defaults (9 frames, 200 ms) apply. modules: default image generation to GPT Image 2.6 at max quality and high complexity, with --complexity #3782's max quality and high complexity defaults still go with every request.
  • Refused before routing or any request: a frame flag without --format gif, and a frame value outside its range or not a whole number. The message names the range.
  • Refused by routing before any request: GIF with --mask (the API has no GIF masks), GIF with --transparent (transparency is documented for png and webp only), and GIF on the 2.5 models or Gemini. The reason names the 2.6 models.
  • If OpenAI refuses GIF with a 400 or 403 that mentions GIF or preview, the error says GIF preview access is required. It drops the generic region and verification hints and is not marked retryable.
  • A GIF dry run reports estimatedCostUsd: null, because OpenAI publishes no per-frame token count.
  • openaiProvider.generate repeats the guards, so a direct caller that skips routing is also refused before fetch.
  • Help text, README, the image-gen skill and a minor changeset document the above.
  • Two citations into the image module had drifted, and are repaired (docs/decisions/governed-writable-workers.md, docs/hosting/paid-cli-provider-qualification.md).

Why this shape

GIF support is a model capability: outputFormats on the 2.6 pair. The existing format filter in routing narrows a GIF request to those models, the same way complexityControl gates --complexity. Masks and transparency are request rules, not model rules, so they are separate hard refusals. Frame defaults are left to the API, as the issue asks, so a later change to OpenAI's defaults needs no code change.

Proof

bun run test in packages/module-images: 194 pass, 0 fail. Root bun run typecheck passes, and bun run lint is clean.

Failing-first. On origin/main with only the new tests added, the brain image — animated GIF on GPT Image 2.6 (#3783) block failed 17 of 17. Every GIF case failed because --format gif was refused with --format must be one of png, jpeg, webp (got "gif"), so the range, mask, transparency, model, dry-run and access-hint assertions did not see their expected messages (IMAGE_GIF_FRAME_RANGE: expected "2 to 16"). The two "frame flag without --format gif" tests failed because the flag was ignored and a request was sent.

Mutation, restored afterwards. I removed the range bound from wholeInRange in src/cli.ts, leaving only the whole-number check. --frames 1, --frames 17, --frame-duration 10 and --frame-duration 2001 then failed: the command exited 0 instead of 1 and sent a request. --frames 4.5 was still refused by the whole-number check. After restoring the file, all 194 tests pass.

An existing test, "an unknown format", used gif as its example of an unknown format. It now uses tiff.

packages/ui-sdk/tests/provider-relay-refusal.test.ts imports the OpenAI image provider's error path, and passes (30 pass, 0 fail).

{"version":1,"kind":"brain-check-pr-receipt","head":"2df91f49a1dce91dd86e2365251650ab0bbb5810","base":"origin/main","mode":"focused","startedAt":"2026-11-10T17:53:58.028Z","finishedAt":"2026-11-10T17:55:02.024Z","checks":[{"name":"all lint and leakage gates","categories":["changeset"],"outcome":"passed","elapsedMs":12001.684019},{"name":"environment documentation","categories":["changeset"],"outcome":"passed","elapsedMs":105.66083800000342},{"name":"pending changeset package names","categories":["changeset"],"outcome":"passed","elapsedMs":100.75152100000196},{"name":"contribution changeset","categories":["changeset"],"outcome":"passed","elapsedMs":18.33612500000163},{"name":"affected fast invariants","categories":["verify","unit"],"outcome":"passed","elapsedMs":51749.889197}]}

Collisions (bun scripts/collisions.ts --json --pr 3868 at head 2df91f49a1dce91dd86e2365251650ab0bbb5810): 0 path or unknown collisions. Two textual overlaps on docs/decisions/governed-writable-workers.md, with #3393 and #3464, come only from the one-line citation repair. The rest are closure-level, through shared test consumers (tests/unit-test-consumers.test.ts), with #3056, #3059, #3116, #3437, #3581, #3622, #3662, #3726, #3772, #3805, #3806, #3827, #3856, #3863, #3867.

Checklist

  • Focused local preflight/behavioral receipts and complete selected hosted proof passed; actual head/base/job checkout evidence is in Proof.
  • Acceptance criteria from the issue are all met, or the gap is named below.
  • The PR and completed/advanced issues have verified release milestones under docs/process/github.md.
  • A changeset is included, or this changes nothing a consumer can see.
  • No personal data anywhere in the diff — the leakage gate covers the whole tree.
  • The integration contract index or relevant component is updated in this same commit, or nothing in the machine surface moved.
  • Docs under docs/ reflect the change, or nothing documented moved.
  • Provider history stays append-only (docs/decisions/provider-history.md): the provider-history guard passes, or nothing on a turn's path changed.

Anything left open

The GIF preview-access hint is matched against wording I inferred, not against a real refusal: no paid or live call was made. If OpenAI's actual message mentions neither "gif" nor "preview", the user sees the plain API message without the hint. SVG (#3784) and markup edits (#3785) remain under #3781. The integration contract is unchanged: --json envelopes did not move, and output simply ends in .gif.

🤖 Generated with Claude Code

Latest refresh: merged main 96ba8a7c8 into head 7fba466b4 (main touched no module-images inputs; check:pr receipt above is from the last real change).

…rames and --frame-duration (#3783)

The 2.6 pair now lists gif among its output formats, so routing narrows a GIF
request to them and refuses it on 2.5 or Gemini with a reason naming the 2.6
models. --frames (2-16) and --frame-duration (20-2000 ms) are validated before
routing, need --format gif, and are sent as frame_count and frame_duration_ms
on generations and multipart edits; unset, nothing is sent and the API's
defaults apply. GIF with a mask or a transparent background is refused before
any request. A 4xx about GIF access carries a hint naming GIF preview access
instead of the generic region/verification hints. A GIF dry run prices as
unknown. The provider repeats the guards for direct callers.

Also repairs two drifted citations into the image module.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@schlessera schlessera added this to the 0.45.0 milestone Nov 10, 2026
@schlessera schlessera added type: feat A new capability or a change in user-visible behaviour. area: modules First-party content modules and the module seam. labels Nov 10, 2026
@schlessera
schlessera marked this pull request as ready for review November 11, 2026 02:07
@schlessera
schlessera merged commit a875fa5 into main Nov 11, 2026
50 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: modules First-party content modules and the module seam. type: feat A new capability or a change in user-visible behaviour.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

modules: generate animated GIFs with GPT Image 2.6 (--format gif, --frames, --frame-duration)

1 participant