Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/internal/image-models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,17 @@ export const IMAGE_MODELS = [
export const DEFAULT_IMAGE_MODEL = "gpt-image-2";

export const IMAGE_MODEL_HELP =
"gpt-image-2 (default, best; ratios 1:1|3:2|2:3) | nano-banana-pro | nano-banana-2 | " +
"gpt-image-2 (default, best; ratios 1:1|16:9|9:16|3:2|2:3) | nano-banana-pro | nano-banana-2 | " +
"nano-banana-2-lite (fastest, cheapest) | nano-banana (legacy)";

export const ASPECT_RATIOS = ["1:1", "16:9", "9:16", "4:3", "3:4", "3:2", "2:3"] as const;

export const ASPECT_RATIO_HELP =
"default: 1:1. nano-banana*: 1:1|16:9|9:16|4:3|3:4. gpt-image-2: 1:1|3:2|2:3. " +
"default: 1:1. nano-banana*: 1:1|16:9|9:16|4:3|3:4. " +
"gpt-image-2: 1:1|16:9|9:16|3:2|2:3. " +
"Mutually exclusive with --generate-multi-view";

const GPT_IMAGE_2_RATIOS = new Set(["1:1", "3:2", "2:3"]);
const GPT_IMAGE_2_RATIOS = new Set(["1:1", "16:9", "9:16", "3:2", "2:3"]);
const NANO_BANANA_RATIOS = new Set(["1:1", "16:9", "9:16", "4:3", "3:4"]);

/**
Expand All @@ -47,7 +48,7 @@ export function checkImageCombo(opts: {
if (!supported.has(ratio)) {
throw new UsageError(
opts.aiModel === "gpt-image-2"
? `--aspect-ratio ${ratio} is not supported by gpt-image-2 (use 1:1, 3:2, or 2:3)`
? `--aspect-ratio ${ratio} is not supported by gpt-image-2 (use 1:1, 16:9, 9:16, 3:2, or 2:3)`
: `--aspect-ratio ${ratio} is only supported by gpt-image-2`,
);
}
Expand Down
6 changes: 3 additions & 3 deletions tests/image-models.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ test("checkImageCombo — multi-view excludes aspect-ratio", () => {
checkImageCombo({ aiModel: "nano-banana", generateMultiView: true });
});

test("checkImageCombo — gpt-image-2 accepts only 1:1, 3:2, 2:3", () => {
for (const ratio of ["1:1", "3:2", "2:3"]) {
test("checkImageCombo — gpt-image-2 accepts square, widescreen, and native ratios", () => {
for (const ratio of ["1:1", "16:9", "9:16", "3:2", "2:3"]) {
checkImageCombo({ aiModel: "gpt-image-2", aspectRatio: ratio });
}
for (const ratio of ["16:9", "9:16", "4:3", "3:4"]) {
for (const ratio of ["4:3", "3:4"]) {
assert.throws(
() => checkImageCombo({ aiModel: "gpt-image-2", aspectRatio: ratio }),
/not supported by gpt-image-2/,
Expand Down
Loading