Description
When using Generate.ts with --model gpt-image-1 without explicitly specifying --size, the CLI fails with an invalid size error.
Steps to Reproduce
bun run Generate.ts --model gpt-image-1 --prompt "test" --output ~/test.png
Expected Behavior
Should use a sensible default size for the model (e.g., 1024x1024 for OpenAI).
Actual Behavior
Error: Invalid size for gpt-image-1: 2K
or
Error: Invalid size: 1024x1024
Root Cause
The validation logic in parseArgs() was structured incorrectly:
if (parsed.model === "gpt-image-1" && !OPENAI_SIZES.includes(parsed.size)) {
throw new CLIError(...);
} else if (parsed.model === "nano-banana-pro") {
// validate gemini sizes
} else if (!REPLICATE_SIZES.includes(parsed.size)) {
throw new CLIError(...); // <-- This catches gpt-image-1 with valid OpenAI sizes!
}
When the model is gpt-image-1 and the size IS valid, the first condition is false, so it falls through to the else if chain and eventually hits the Replicate size check.
Fix
PR #379 restructures the logic to properly branch per model type and apply sensible defaults.
Environment
- PAI version: main branch
- Pack: pai-art-skill v1.1.0
Description
When using
Generate.tswith--model gpt-image-1without explicitly specifying--size, the CLI fails with an invalid size error.Steps to Reproduce
Expected Behavior
Should use a sensible default size for the model (e.g.,
1024x1024for OpenAI).Actual Behavior
or
Root Cause
The validation logic in
parseArgs()was structured incorrectly:When the model is
gpt-image-1and the size IS valid, the first condition is false, so it falls through to theelse ifchain and eventually hits the Replicate size check.Fix
PR #379 restructures the logic to properly branch per model type and apply sensible defaults.
Environment