Skip to content

feat(image-generator): add gpt-image-2 model support#4437

Merged
waleedlatif1 merged 2 commits intostagingfrom
waleedlatif1/gpt-image-2
May 4, 2026
Merged

feat(image-generator): add gpt-image-2 model support#4437
waleedlatif1 merged 2 commits intostagingfrom
waleedlatif1/gpt-image-2

Conversation

@waleedlatif1
Copy link
Copy Markdown
Collaborator

Summary

  • Add gpt-image-2 as a model option in the Image Generator block
  • Wire up gpt-image-2 specific params: size (auto, 1024², 1536×1024, 1024×1536, 2048², 3840×2160), quality (auto/low/medium/high), background (auto/opaque — transparent not supported per docs), output_format (png/jpeg/webp), moderation (auto/low)
  • Share quality/background/output_format wiring with gpt-image-1; moderation is gpt-image-2 only
  • Verified parameter values against OpenAI's official gpt-image-2 docs

Type of Change

  • New feature

Testing

Tested manually. Type check passes.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link
Copy Markdown

vercel Bot commented May 4, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment May 4, 2026 8:51pm

Request Review

@cursor
Copy link
Copy Markdown

cursor Bot commented May 4, 2026

PR Summary

Medium Risk
Moderate risk because it expands the image generation parameter surface and request shaping for a new OpenAI model, and flips a block’s authType from none to api-key, which could affect access/config in production.

Overview
Adds gpt-image-2 support to the Image Generator block and openai_image tool, including new UI options and request params (quality, background, outputFormat, moderation) plus model-specific validation/defaulting for size and other fields.

Updates docs and integration metadata to reflect the new image model capabilities, refreshes Knowledge tool docs with new reranker inputs, updates Mem0 docs to match new async/paginated response fields, and adds a new table trigger docs page and entry in triggers meta.json. Also changes one integration’s authType in integrations.json from none to api-key.

Reviewed by Cursor Bugbot for commit 4073f0d. Configure here.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 4, 2026

Greptile Summary

Adds gpt-image-2 as a third model option in the Image Generator block, wiring up its dedicated size options (up to 3840×2160), quality levels, background (opaque/auto only), output format, and moderation parameters. The implementation correctly validates size, quality, and background via ALLOWED_* allowlists in the block params function, maps camelCase outputFormat → snake_case output_format in the tool, and shares the quality/outputFormat/moderation path with gpt-image-1. The PR also includes several unrelated documentation changes (knowledge, mem0, table trigger docs) and a authType: "none" → "api-key" fix for the knowledge integration entry in integrations.json.

Confidence Score: 5/5

Safe to merge — no P0 or P1 issues found in the feature implementation.

The core feature code is correct: new params are validated against allowlists, the camelCase → snake_case mapping is handled in the right layer, the response handler already supports b64_json for gpt-image-2, and dall-e-3 is not affected. The one open comment is a P2 documentation nit on an unrelated table trigger doc file.

No files require special attention; the documentation in apps/docs/content/docs/en/triggers/table.mdx has a minor duplicate description worth cleaning up.

Important Files Changed

Filename Overview
apps/sim/blocks/blocks/image_generator.ts Added gpt-image-2 model with dedicated size/quality/background/outputFormat/moderation dropdowns; validation via ALLOWED_* allowlists for size, quality, and background; outputFormat and moderation are passed through without server-side validation (consistent with pre-existing background handling).
apps/sim/tools/openai/image.ts Extended request builder to forward quality, outputFormat (→ output_format), and moderation for gpt-image-1 and gpt-image-2; updated size default fallback; improved log message to interpolate model name.
apps/sim/app/(landing)/integrations/data/integrations.json Two changes: image-generator longDescription updated to mention GPT Image 2; knowledge block authType changed from "none" to "api-key" (likely coincidental, correct given the Cohere API key now documented for the knowledge block).
apps/docs/content/docs/en/triggers/table.mdx New trigger documentation; tableSelector and manualTableId share the identical description "The table to monitor." and are both marked Required, which is misleading.
apps/docs/content/docs/en/tools/image_generator.mdx Updated parameter table to document gpt-image-2 size options, quality levels, background, outputFormat, and moderation; correctly reflects the block implementation.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Image Generator Block] --> B{Model Selection}
    B -->|dall-e-3| C[Size: 1024x1024 / 1024x1792 / 1792x1024\nQuality: standard / hd\nStyle: vivid / natural]
    B -->|gpt-image-1| D[Size: auto / 1024x1024 / 1536x1024 / 1024x1536\nQuality: auto / low / medium / high\nBackground: auto / transparent / opaque\nOutputFormat: png / jpeg / webp\nModeration: auto / low]
    B -->|gpt-image-2 NEW| E[Size: auto / 1024x1024 / 1536x1024 / 1024x1536 / 2560x1440 / 3840x2160\nQuality: auto / low / medium / high\nBackground: auto / opaque\nOutputFormat: png / jpeg / webp\nModeration: auto / low]
    C --> F[ALLOWED_* Validation in block params]
    D --> F
    E --> F
    F --> G[imageTool POST /v1/images/generations]
    G -->|dall-e-3| H[url response → proxy fetch → base64]
    G -->|gpt-image-1 / gpt-image-2| I[b64_json response → base64]
    H --> J[Output: image base64 + metadata]
    I --> J
Loading

Reviews (4): Last reviewed commit: "docs" | Re-trigger Greptile

@waleedlatif1 waleedlatif1 force-pushed the waleedlatif1/gpt-image-2 branch from e3b2210 to 9b0dfdc Compare May 4, 2026 20:33
@waleedlatif1 waleedlatif1 force-pushed the waleedlatif1/gpt-image-2 branch from 9b0dfdc to ef93928 Compare May 4, 2026 20:33
@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@cursor review

@waleedlatif1 waleedlatif1 force-pushed the waleedlatif1/gpt-image-2 branch from ef93928 to 4d7079b Compare May 4, 2026 20:39
@waleedlatif1 waleedlatif1 force-pushed the waleedlatif1/gpt-image-2 branch from 4d7079b to bbb6ba1 Compare May 4, 2026 20:40
Comment thread apps/sim/blocks/blocks/image_generator.ts
@waleedlatif1 waleedlatif1 force-pushed the waleedlatif1/gpt-image-2 branch from bbb6ba1 to 8b052b9 Compare May 4, 2026 20:45
@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@cursor review

Comment thread apps/sim/blocks/blocks/image_generator.ts
Comment thread apps/sim/blocks/blocks/image_generator.ts
Comment thread apps/sim/blocks/blocks/image_generator.ts
Comment thread apps/sim/tools/openai/image.ts
@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@greptileai please re-review — all prior comments resolved.

@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@cursor review

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 8b052b9. Configure here.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 4073f0d. Configure here.

@waleedlatif1 waleedlatif1 merged commit 6d044a9 into staging May 4, 2026
14 checks passed
@waleedlatif1 waleedlatif1 deleted the waleedlatif1/gpt-image-2 branch May 4, 2026 22:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant