Skip to content

[Workers AI] Fix gpt-image-2 input field: image -> images#30526

Merged
superhighfives merged 1 commit intoproductionfrom
fix/gpt-image-2-images-field
May 4, 2026
Merged

[Workers AI] Fix gpt-image-2 input field: image -> images#30526
superhighfives merged 1 commit intoproductionfrom
fix/gpt-image-2-images-field

Conversation

@superhighfives
Copy link
Copy Markdown
Contributor

The docs for openai/gpt-image-2 show the edit input as image (singular), but the runtime rejects that with:

Valid fields: prompt, images, quality, size, background, output_format

So users following the docs hit a 400 immediately. Reported by Craig Dennis after Clanker copied the example verbatim.

This updates src/content/catalog-models/openai-gpt-image-2.json so the input schema, the Image Edit example, and the TypeScript snippet all use images as an array (up to 16 entries, base64 strings or data: URIs). Also adds a Multi-Image Edit example to show the array form.

  • input schema: image: string -> images: string[] (maxItems: 16)
  • Image Edit example + code snippet updated to pass images: [...]
  • new Multi-Image Edit example demonstrating multi-reference composition

Result on the rendered page:

const response = await env.AI.run('openai/gpt-image-2', {
  prompt: 'Transform this cartoon smiley into a photorealistic 3D clay sculpture...',
  images: ['data:image/png;base64,...'],
}, { gateway: { id: 'default' } })

Heads up - this file is regenerated by bin/fetch-catalog-models.ts from the Unified Catalog API, so the upstream catalog also needs the same fix or the next sync will revert this. CCing catalog owners per CODEOWNERS so they can chase that down: @abhishekkankani @palashgo @thebongy @roerohan @kathayl.

The runtime API rejects the documented 'image' field with: Valid fields: prompt, images, quality, size, background, output_format. Update the catalog JSON so the schema, Image Edit example, and code snippet use 'images' (array, up to 16). Adds a Multi-Image Edit example to show the array form.
Copilot AI review requested due to automatic review settings May 2, 2026 00:37
@github-actions github-actions Bot added the size/s label May 2, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 2, 2026

This pull request requires reviews from CODEOWNERS as it changes files that match the following patterns:

Pattern Owners
/src/content/catalog-models/ @abhishekkankani, @palashgo, @thebongy, @roerohan, @kathayl, @mchenco, @zeke, @superhighfives, @bfirsh, @mattrothenberg, @ethulia, @cloudflare/content-engineering, @cloudflare/pcx-technical-writing, @cloudflare/product-owners

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes the openai/gpt-image-2 catalog entry so “image edit” requests match the Workers AI runtime contract (which expects images rather than image), preventing immediate 400s when users follow the docs.

Changes:

  • Update the Image Edit example and TypeScript snippet to pass images: [...] instead of image: ....
  • Add a new “Multi-Image Edit” example demonstrating multiple reference images.
  • Update the input JSON schema from image: string to images: string[] with maxItems: 16 (and reformat some arrays inline).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/content/catalog-models/openai-gpt-image-2.json
Comment thread src/content/catalog-models/openai-gpt-image-2.json
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 2, 2026

@superhighfives superhighfives merged commit 68279fc into production May 4, 2026
26 checks passed
@superhighfives superhighfives deleted the fix/gpt-image-2-images-field branch May 4, 2026 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants