Repository navigation
feat(images): animated GIFs from GPT Image 2.6 with --format gif, --frames and --frame-duration (#3783) - #3868
Merged
Merged
Conversation
…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>
Closed
5 tasks
This was referenced Nov 10, 2026
4 of 6 tasks
schlessera
marked this pull request as ready for review
November 11, 2026 02:07
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #3783. Part of #3781.
What changed
brain image --format gifasks a GPT Image 2.6 model (gpt-image-2.6-sunburstby default, orgpt-image-2.6-flare) for an animated GIF, as a new image or as an edit with--ref. The bytes are written to a.gifpath with mimeimage/gif.--frames <2-16>and--frame-duration <20-2000 ms>are sent asframe_countandframe_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'smaxquality andhighcomplexity defaults still go with every request.--format gif, and a frame value outside its range or not a whole number. The message names the range.--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.estimatedCostUsd: null, because OpenAI publishes no per-frame token count.openaiProvider.generaterepeats the guards, so a direct caller that skips routing is also refused before fetch.image-genskill and a minor changeset document the above.docs/decisions/governed-writable-workers.md,docs/hosting/paid-cli-provider-qualification.md).Why this shape
GIF support is a model capability:
outputFormatson the 2.6 pair. The existing format filter in routing narrows a GIF request to those models, the same waycomplexityControlgates--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 testinpackages/module-images: 194 pass, 0 fail. Rootbun run typecheckpasses, andbun run lintis clean.Failing-first. On
origin/mainwith only the new tests added, thebrain image — animated GIF on GPT Image 2.6 (#3783)block failed 17 of 17. Every GIF case failed because--format gifwas 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
wholeInRangeinsrc/cli.ts, leaving only the whole-number check.--frames 1,--frames 17,--frame-duration 10and--frame-duration 2001then failed: the command exited 0 instead of 1 and sent a request.--frames 4.5was still refused by the whole-number check. After restoring the file, all 194 tests pass.An existing test, "an unknown format", used
gifas its example of an unknown format. It now usestiff.packages/ui-sdk/tests/provider-relay-refusal.test.tsimports 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 3868at head2df91f49a1dce91dd86e2365251650ab0bbb5810): 0 path or unknown collisions. Two textual overlaps ondocs/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
docs/reflect the change, or nothing documented moved.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:
--jsonenvelopes did not move, andoutputsimply ends in.gif.🤖 Generated with Claude Code
Latest refresh: merged main
96ba8a7c8into head7fba466b4(main touched no module-images inputs; check:pr receipt above is from the last real change).