Skip to content

bug(pai-art-skill): Generate.ts size validation fails for gpt-image-1 model #380

Description

@b1ackmartian

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions