Personal_AI_Infrastructure
Personal_AI_Infrastructure copied to clipboard
Fix size validation for OpenAI model in Art skill (PAI v2.1)
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