Repository navigation
feat: put image providers on one contract and drop CLI provider branches - #355
Merged
Merged
Conversation
Image generation and editing were duplicated per provider in five CLI places (generate image, the image executor, edit image, scene visuals, and two build helpers), each with its own fetch, error parsing, model mapping, and URL-vs-base64 handling. - `ImageGenerator` (ai-providers/src/image): `createImage(request)` returns image bytes; a request with input images is an edit. `maxEditImages` declares each provider's edit limit (OpenAI 16, Gemini 3 / Pro 14, Grok 1). `createImageGenerator(provider, key)` opens one by name. - OpenAI, Gemini, and Grok implement it over `providerRequest` with `ProviderError` kinds; unknown models are refused before any request, and the old `generateImage` / `editImage` methods wrap it. - Gemini sends its key as a header instead of `?key=` in the URL, and a safety block reads as moderation. Grok asks for base64, so nothing downloads expiring URLs. - The CLI's generate image, edit image, scene visuals, and build backdrops/keyframes all go through the contract (`executeImageGenerate`, `executeImageEdit`). `resolveCatalogModel` generalizes the video model resolver. Fixes: - OpenAI generation ignored the model and the aspect ratio; OpenAI edits ignored the model (and the spinner always said GPT Image 1.5). - `edit image -m` defaulted to the Gemini alias `flash` for every provider. - Grok backdrops ignored the build's image model. - `--count N` saved only the first image; all are saved now (out-2.png...). - Scene visuals wrote Gemini JPEG bytes into .png files. - `generate image -p runway` ran a Python script that no longer exists. - A missing image key surfaced as API_ERROR instead of API_KEY_MISSING. - `edit image` used a hardcoded Gemini model-ID map instead of the catalog. - The MCP build tool allowed only OpenAI images though builds support Gemini and Grok; DALL-E's `style` option is gone from the pipeline. Claude-Session: https://claude.ai/code/session_011S1BLTaFctZNQzGERpkCuA
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This was referenced Oct 5, 2026
This branch was successfully deployed
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.
Image counterpart of the video provider work (#349-#353).
Why
Image generation and editing were duplicated per provider in five CLI places:
generate image, the image executor,edit image, scene visuals, and two build helpers. Each had its own fetch, error parsing, model mapping, and URL-vs-base64 handling, and they had drifted apart (see the fixes below).What changes
ImageGeneratorcontract (ai-providers/src/image):createImage(request)returns image bytes; a request with input images is an edit.maxEditImagesdeclares the edit limit: OpenAI 16, Gemini 3 (Pro 14), Grok 1.createImageGenerator(provider, key)opens a provider by name.providerRequestwithProviderErrorkinds.?key=in the URL, and a safety block reads asmoderation.generateImageandeditImagewrap the contract.generate image,edit image, scene visuals, and build backdrops and keyframes all go through it, viaexecuteImageGenerateandexecuteImageEdit.edit_imagegains aproviderparameter.Fixes
edit image -mdefaulted to the Gemini aliasflashfor every provider.--count Nsaved only the first image. All are saved now (out.png,out-2.png, ...)..pngfiles.generate image -p runwayran a Python script that no longer exists, so it always failed. The option is removed.API_ERROR(exit 5, no hints) instead ofAPI_KEY_MISSING(exit 4, setup hints).edit imageused a hardcoded Gemini model-ID map instead of the catalog.buildtool allowed only OpenAI images, though builds support Gemini and Grok.styleoption, which GPT Image rejects, is gone from the pipeline.Verification
createImageGenerator.pnpm build,lint,typecheck, tests (providers 228, CLI 1342 including integration, MCP 73), pre-push gate.generate image -p openai -r 16:9: 1536x1024, where it used to be 1024x1024.-p gemini -m lite -r 16:9: 1376x768.-p grok --count 2: two files saved, all PNG.edit image -p openai -m flareand-p grok: both applied the edit with the scene kept.https://claude.ai/code/session_011S1BLTaFctZNQzGERpkCuA