Skip to content

Conversation

@Azd325
Copy link

@Azd325 Azd325 commented Jan 5, 2026

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.
@danielmiessler
Copy link
Owner

Thank you @Azd325 for this Art skill fix! 🙏

Great catch on the size validation logic. We've released PAI v2.1 which renamed all packs from kai-* to pai-*, so this path no longer exists.

If you'd like to re-apply this fix to Packs/pai-art-skill/src/skills/Art/Tools/Generate.ts, we'd happily merge it!

See the release: https://github.com/danielmiessler/PAI/releases/tag/v2.1.0

@Azd325
Copy link
Author

Azd325 commented Jan 8, 2026

Updated the fix to apply to the new path. New PR #348

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