Skip to content

Fix size validation for OpenAI model in Art skill (PAI v2.1)#348

Closed
Azd325 wants to merge 1 commit into
danielmiessler:mainfrom
Azd325:fix/art-generate-size-validation
Closed

Fix size validation for OpenAI model in Art skill (PAI v2.1)#348
Azd325 wants to merge 1 commit into
danielmiessler:mainfrom
Azd325:fix/art-generate-size-validation

Conversation

@Azd325

@Azd325 Azd325 commented Jan 8, 2026

Copy link
Copy Markdown

What Problem This Solves

The Art skill's Generate.ts tool was rejecting valid OpenAI image sizes (1536x1024, 1024x1536) with an "Invalid size" error.

Root Cause

The size validation logic was falling through to check OpenAI sizes against Replicate's aspect ratio format, causing valid sizes to be rejected.

The Fix

Changed the validation from:

if (parsed.model === "gpt-image-1" && !OPENAI_SIZES.includes(...))

To proper if-else-if structure:

if (parsed.model === "gpt-image-1") {
  if (!OPENAI_SIZES.includes(...)) { throw error }
}

Testing Done

✅ Verified OpenAI model now works with all valid sizes: 1024x1024, 1536x1024, 1024x1536
✅ Tested image generation completes successfully
✅ Confirmed no impact on other models (nano-banana-pro, flux, nano-banana)

Example

bun run Generate.ts --model gpt-image-1 --size 1536x1024 --prompt "test" --output test.png
# Previously: Error: Invalid size: 1536x1024
# Now: Successfully generates image

The validation was incorrectly falling through to REPLICATE_SIZES check
for gpt-image-1 model, causing valid OpenAI sizes to be rejected.

Changed the if-else-if chain to properly handle each model type:
- gpt-image-1 now validates against OPENAI_SIZES only
- nano-banana-pro validates against GEMINI_SIZES only
- Other models validate against REPLICATE_SIZES

This allows gpt-image-1 to accept its valid sizes (1024x1024, 1536x1024, 1024x1536)
without incorrectly checking against Replicate's aspect ratio format.
@madeinoz67

Copy link
Copy Markdown

thanks was about to do the same, you beat me :D thanks again

@Azd325 Azd325 closed this Jan 24, 2026
@Azd325
Azd325 deleted the fix/art-generate-size-validation branch January 24, 2026 12:51
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.

2 participants