@koda-sl/baker-cli 0.148.0 → 0.149.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1643,6 +1643,8 @@ baker images stock "office reaction" --people only
1643
1643
 
1644
1644
  Free tier exists but watermarks previews — pass `--license freemium` to filter to clean free assets explicitly.
1645
1645
 
1646
+ An empty result comes back with `hints` naming the filters that narrowed the search plus the fallbacks (`baker images find --sources …`, `baker images generate`); a provider failure returns an `error.fix` pointing at the same exits. `baker images google` does the same, minus the cross-provider fallback (it is the last-resort provider).
1647
+
1646
1648
  **Flags:**
1647
1649
 
1648
1650
  | Flag | Description |
@@ -1724,13 +1726,15 @@ baker images generate "flat geometric mascot, brand palette" \
1724
1726
  | Model | Best for | Aspect ratios | Sizes |
1725
1727
  |---|---|---|---|
1726
1728
  | `google/gemini-3.1-flash-image-preview` **(default)** | Fast iteration, reference editing, extreme aspect ratios (Nano Banana flash) | standard **+** `1:4` `4:1` `1:8` `8:1` | `0.5K`–`4K` |
1727
- | `google/gemini-3.5-flash` | Fast; extreme aspect ratios | standard **+** `1:4` `4:1` `1:8` `8:1` | `0.5K`–`4K` |
1728
1729
  | `google/gemini-3-pro-image-preview` | Highest fidelity (Nano Banana Pro) — strong prompt adherence and reference grounding | standard set | `1K` `2K` `4K` |
1729
- | `openai/gpt-5.4-image-2` | Photoreal + cleanest in-image text — ad/landing reproduction | standard set | `1K` `2K` `4K` |
1730
+ | `openai/gpt-image-2` | Photoreal + cleanest in-image text — ad/landing reproduction | standard set **minus** `4:5` `5:4` | *(none — derived from the ratio)* |
1731
+ | `openai/gpt-5.4-image-2` | **Legacy** — accepted so canvases authored before the gpt-image-2 switch still re-run. Don't pick it for new work. | standard set | `1K` `2K` `4K` (ignored upstream) |
1730
1732
  | `recraft/recraft-v4.1-pro-vector` | Vector/flat/SVG-style with palette control | standard set | `1K` `2K` `4K` |
1731
1733
 
1732
1734
  Standard aspect ratios: `1:1` `2:3` `3:2` `3:4` `4:3` `4:5` `5:4` `9:16` `16:9` `21:9`.
1733
1735
 
1736
+ `openai/gpt-image-2` accepts neither `image_size` nor the `4:5` / `5:4` portrait ratios — OpenAI picks the pixel dimensions from the ratio. To ship a 4:5 Meta feed ad from it, render the hero at `3:4` and adapt with `image_aspect_adapt`; the scaffolders do this for you.
1737
+
1734
1738
  **Flags:**
1735
1739
 
1736
1740
  | Flag | Description |
@@ -2747,7 +2751,7 @@ A re-run with no changes hits the cache for every node — total runtime drops t
2747
2751
  "type": "text_generate",
2748
2752
  "inputs": { "topic": "$ref:topic.text" },
2749
2753
  "params": {
2750
- "model": "google/gemini-3.5-flash",
2754
+ "model": "google/gemini-3.1-flash-image-preview",
2751
2755
  "prompt": "Write a 6-word tagline for {{topic}}."
2752
2756
  }
2753
2757
  }
@@ -3046,37 +3050,31 @@ Aspect-ratio sets used below:
3046
3050
 
3047
3051
  ---
3048
3052
 
3049
- ###### Model: `openai/gpt-5.4-image-2`
3053
+ ###### Model: `openai/gpt-image-2`
3050
3054
 
3051
- Photorealistic generalist. Optional `reference` image.
3055
+ Photorealistic generalist, and the cleanest at rendering text inside the image. Optional `reference` image (up to 16).
3052
3056
 
3053
3057
  | Name | Type | Required | Notes |
3054
3058
  |---|---|---|---|
3055
- | `model` | literal | yes | `"openai/gpt-5.4-image-2"` |
3059
+ | `model` | literal | yes | `"openai/gpt-image-2"` |
3056
3060
  | `prompt` | string | yes | non-empty |
3057
- | `aspect_ratio` | enum | no | STD AR |
3058
- | `image_size` | enum | no | `1K \| 2K \| 4K` |
3061
+ | `aspect_ratio` | enum | no | GPT AR = `1:1, 2:3, 3:2, 3:4, 4:3, 9:16, 16:9, 21:9` — **no `4:5` / `5:4`** |
3059
3062
  | `quality` | enum | no | `auto \| low \| medium \| high` — rendering quality; the scaffolder sets `high` for photoreal frames. (Do **not** pass `input_fidelity`: gpt-image-2 forces high fidelity automatically and the param can fail the request.) |
3060
3063
 
3064
+ No `image_size`: OpenAI derives the pixel dimensions from the ratio, so a size is ignored. For a portrait ad format, render at `3:4` and adapt.
3065
+
3061
3066
  ```json
3062
3067
  { "id": "hero", "type": "image_generate",
3063
- "params": { "model": "openai/gpt-5.4-image-2", "prompt": "Photorealistic photo of …", "aspect_ratio": "16:9", "image_size": "2K", "quality": "high" } }
3068
+ "params": { "model": "openai/gpt-image-2", "prompt": "Photorealistic photo of …", "aspect_ratio": "16:9", "quality": "high" } }
3064
3069
  ```
3065
3070
 
3066
- ###### Model: `google/gemini-3.5-flash`
3067
-
3068
- Newest Gemini Flash image model. Always returns an image output. Best for fast iteration; supports extreme aspect ratios and the `0.5K` size for cheap previews.
3071
+ ###### Model: `openai/gpt-5.4-image-2` (legacy)
3069
3072
 
3070
- | Name | Type | Required | Notes |
3071
- |---|---|---|---|
3072
- | `model` | literal | yes | `"google/gemini-3.5-flash"` |
3073
- | `prompt` | string | yes | non-empty |
3074
- | `aspect_ratio` | enum | no | EXTREME AR |
3075
- | `image_size` | enum | no | `0.5K \| 1K \| 2K \| 4K` |
3073
+ Kept only so canvases authored before the gpt-image-2 switch still validate and re-run unchanged — `baker canvas rerun` replays a recorded canvas verbatim. It keeps the full standard ratio set (including `4:5` / `5:4`) and still accepts `image_size`, which the provider ignores. Prefer `openai/gpt-image-2` for anything new.
3076
3074
 
3077
3075
  ###### Model: `google/gemini-3.1-flash-image-preview`
3078
3076
 
3079
- Preview-channel Gemini flash. Same param surface as `3.5-flash`.
3077
+ Gemini flash image model — the default. Fast iteration, reference editing, extreme aspect ratios, and the `0.5K` size for cheap previews.
3080
3078
 
3081
3079
  | Name | Type | Required | Notes |
3082
3080
  |---|---|---|---|
@@ -3293,7 +3291,7 @@ There is no `prompt` param — the extraction schema is the node. Use `focus` to
3293
3291
  "params": { "model": "~google/gemini-pro-latest" } },
3294
3292
  { "id": "remix", "type": "image_generate",
3295
3293
  "inputs": { "blueprint": "$ref:blueprint.description" },
3296
- "params": { "model": "openai/gpt-5.4-image-2",
3294
+ "params": { "model": "openai/gpt-image-2",
3297
3295
  "prompt": "Recreate an image matching this exact blueprint, but swap the product for a ceramic mug:\n{{blueprint}}" } }
3298
3296
  ],
3299
3297
  "output": { "node": "remix", "output": "images" }
@@ -3374,9 +3372,9 @@ Fail-fast: an invalid model selection (wrong count, duplicate or out-of-range pi
3374
3372
  {
3375
3373
  "schema": "baker-canvas/1",
3376
3374
  "nodes": [
3377
- { "id": "a", "type": "image_generate", "params": { "model": "google/gemini-3.5-flash", "prompt": "hero shot of a ceramic mug, warm morning light" } },
3378
- { "id": "b", "type": "image_generate", "params": { "model": "google/gemini-3.5-flash", "prompt": "hero shot of a ceramic mug, studio softbox" } },
3379
- { "id": "c", "type": "image_generate", "params": { "model": "google/gemini-3.5-flash", "prompt": "hero shot of a ceramic mug, dramatic side light" } },
3375
+ { "id": "a", "type": "image_generate", "params": { "model": "google/gemini-3.1-flash-image-preview", "prompt": "hero shot of a ceramic mug, warm morning light" } },
3376
+ { "id": "b", "type": "image_generate", "params": { "model": "google/gemini-3.1-flash-image-preview", "prompt": "hero shot of a ceramic mug, studio softbox" } },
3377
+ { "id": "c", "type": "image_generate", "params": { "model": "google/gemini-3.1-flash-image-preview", "prompt": "hero shot of a ceramic mug, dramatic side light" } },
3380
3378
  { "id": "best", "type": "image_select",
3381
3379
  "inputs": { "images": ["$ref:a.images#0", "$ref:b.images#0", "$ref:c.images#0"] },
3382
3380
  "params": { "model": "~google/gemini-pro-latest", "prompt": "most premium-feeling lighting, no harsh shadows" } }
@@ -4078,7 +4076,7 @@ baker canvas run ./reference-ad.video.canvas.json
4078
4076
  | `--focus <text>` | — | Known provenance/emphasis to ground the deconstruct. |
4079
4077
  | `--deconstruct-model <id>` | `~google/gemini-pro-latest` | Override the `video_deconstruct` model. |
4080
4078
  | `--select-model <id>` | `~google/gemini-flash-latest` | Override the element-selection `text_generate` model. |
4081
- | `--image-model <id>` | `openai/gpt-5.4-image-2` | Override the per-frame `image_generate` model (defaults to the strongest, matching `scaffold-static-ad`). |
4079
+ | `--image-model <id>` | `openai/gpt-image-2` | Override the per-frame `image_generate` model (defaults to the strongest, matching `scaffold-static-ad`). |
4082
4080
  | `--video-model <id>` | scored router | Override the `video_generate` model **and skip the router**. Curated roster: `bytedance/seedance-2.0` (workhorse), `google/veo-3.1` (cine ceiling + real-face), `google/veo-3.1-fast` (cheap Veo), `kwaivgi/kling-v3.0-pro` (motion-transfer). |
4083
4081
  | `--real-face` | auto-detected | Force the Veo route for a photoreal human presenter (dodges the ByteDance real-person filter). **Usually unnecessary** — the scaffold auto-detects a photoreal on-camera person/animal cast from the deconstruct and routes it to Veo on its own; set this only to force it when the cast isn't detected. Covers AI-generated photoreal faces too, not just real ones. |
4084
4082
  | `--motion-transfer` | off | Motion driven from a reference / hyper-dynamic → the router picks Kling. |
@@ -4135,7 +4133,7 @@ baker canvas run ./static-ad.canvas.json
4135
4133
  | `--describe-model <id>` | registry default (`~google/gemini-pro-latest`) | Override the `image_describe` model. |
4136
4134
  | `--select-model <id>` | registry default (`~google/gemini-flash-latest`) | Override the element-selection `text_generate` model. |
4137
4135
  | `--layout-model <id>` | registry default (`~google/gemini-flash-latest`) | Override the global-layout `text_generate` model. |
4138
- | `--gen-model <id>` | registry default (`openai/gpt-5.4-image-2`) | Override the `image_generate` model. |
4136
+ | `--gen-model <id>` | registry default (`openai/gpt-image-2`) | Override the `image_generate` model. |
4139
4137
  | `--platform <channel>` | `meta` | `_definition.md` channel **and** the default placement set the hero fans out to (`meta`\|`google`\|`linkedin`\|`tiktok`\|`youtube`\|`x`\|`other`; `x`/`other` fan out to nothing). |
4140
4138
  | `--placements <preset\|none>` | derived from `--platform` | Override the fan-out set: `meta_feed`\|`meta_feed_stories`\|`meta_all`\|`linkedin`\|`google_demandgen`\|`tiktok`\|`youtube`, or `none` for a single base ad. |
4141
4139
  | `--aspect <ratio>` | inferred from the image, else `9:16` | Force the hero's aspect ratio (clamped into the placement set so it stays a free pass-through). |
@@ -1114,6 +1114,7 @@ function normalizeForCanonical(value) {
1114
1114
  // ../canvas-contract/src/registry.ts
1115
1115
  var OPENROUTER_IMAGE_AR = ["1:1", "2:3", "3:2", "3:4", "4:3", "4:5", "5:4", "9:16", "16:9", "21:9"];
1116
1116
  var OPENROUTER_IMAGE_AR_EXTREME = [...OPENROUTER_IMAGE_AR, "1:4", "4:1", "1:8", "8:1"];
1117
+ var OPENROUTER_IMAGE_AR_GPT = ["1:1", "2:3", "3:2", "3:4", "4:3", "9:16", "16:9", "21:9"];
1117
1118
  var OPENROUTER_IMAGE_SIZE = ["1K", "2K", "4K"];
1118
1119
  var OPENROUTER_IMAGE_SIZE_EXTENDED = ["0.5K", ...OPENROUTER_IMAGE_SIZE];
1119
1120
  var OPENROUTER_IMAGE_QUALITY = ["auto", "low", "medium", "high"];
@@ -1134,8 +1135,8 @@ var REPLICATE_VIDEO_MIMES = ["video/mp4", "video/webm", "video/quicktime"];
1134
1135
  var DECONSTRUCT_VIDEO_MIMES = ["video/mp4", "video/webm", "video/quicktime"];
1135
1136
  var REPLICATE_AUDIO_MIMES = ["audio/wav", "audio/mpeg", "audio/mp3"];
1136
1137
  var IMAGE_GENERATE_MODELS = [
1138
+ "openai/gpt-image-2",
1137
1139
  "openai/gpt-5.4-image-2",
1138
- "google/gemini-3.5-flash",
1139
1140
  "google/gemini-3.1-flash-image-preview",
1140
1141
  "google/gemini-3-pro-image-preview",
1141
1142
  "recraft/recraft-v4.1-pro-vector"
@@ -1234,28 +1235,37 @@ var MODEL_REGISTRY = {
1234
1235
  // `seed` is omitted on every entry — OpenRouter's `image_config` schema
1235
1236
  // has no `seed` slot for image-gen (different from video-gen), so passing
1236
1237
  // it would be a silent no-op.
1237
- "openai/gpt-5.4-image-2": {
1238
- label: "OpenAI GPT-5.4 Image 2",
1238
+ // The direct image model, not the `gpt-5.4-image-2` chat model that emitted
1239
+ // images as a side effect. Notable capability gaps vs the Gemini entries:
1240
+ // no `image_size` (OpenAI picks the pixel dimensions from the ratio, and a
1241
+ // `resolution` is silently ignored) and the narrower `..._AR_GPT` ratio set.
1242
+ "openai/gpt-image-2": {
1243
+ label: "OpenAI GPT Image 2",
1239
1244
  inputs: [],
1240
1245
  optional_inputs: [{ kind: "image", mimes: OPENROUTER_IMAGE_MIMES }],
1241
1246
  required: ["prompt"],
1242
1247
  params: {
1243
1248
  prompt: { kind: "string" },
1244
- aspect_ratio: { kind: "string", enum: OPENROUTER_IMAGE_AR },
1245
- image_size: { kind: "string", enum: OPENROUTER_IMAGE_SIZE },
1249
+ aspect_ratio: { kind: "string", enum: OPENROUTER_IMAGE_AR_GPT },
1246
1250
  quality: { kind: "string", enum: OPENROUTER_IMAGE_QUALITY }
1247
1251
  }
1248
1252
  },
1249
- "google/gemini-3.5-flash": {
1250
- // Newer Gemini flash image model. Always returns an image output.
1251
- label: "Google Gemini 3.5 Flash (Image)",
1253
+ // LEGACY — kept so canvases authored before the gpt-image-2 switch still
1254
+ // validate and re-run unchanged (`baker canvas rerun` restores a recorded
1255
+ // canvas verbatim, so dropping this model would break every stored creative
1256
+ // that used it). Its param surface is the ORIGINAL one on purpose: unlike
1257
+ // gpt-image-2 it still honors 4:5/5:4, and `image_size` is accepted-then-
1258
+ // ignored upstream rather than rejected. Verified live on /api/v1/images.
1259
+ // Don't reach for it in new work — the scaffolders default to gpt-image-2.
1260
+ "openai/gpt-5.4-image-2": {
1261
+ label: "OpenAI GPT-5.4 Image 2 (legacy)",
1252
1262
  inputs: [],
1253
1263
  optional_inputs: [{ kind: "image", mimes: OPENROUTER_IMAGE_MIMES }],
1254
1264
  required: ["prompt"],
1255
1265
  params: {
1256
1266
  prompt: { kind: "string" },
1257
- aspect_ratio: { kind: "string", enum: OPENROUTER_IMAGE_AR_EXTREME },
1258
- image_size: { kind: "string", enum: OPENROUTER_IMAGE_SIZE_EXTENDED },
1267
+ aspect_ratio: { kind: "string", enum: OPENROUTER_IMAGE_AR },
1268
+ image_size: { kind: "string", enum: OPENROUTER_IMAGE_SIZE },
1259
1269
  quality: { kind: "string", enum: OPENROUTER_IMAGE_QUALITY }
1260
1270
  }
1261
1271
  },
@@ -1607,6 +1617,36 @@ var MODEL_REGISTRY = {
1607
1617
  }
1608
1618
  }
1609
1619
  };
1620
+ function supportsParam(kind, model, param) {
1621
+ return MODEL_REGISTRY[kind]?.[model]?.params[param] !== void 0;
1622
+ }
1623
+ function supportedAspectRatios(kind, model) {
1624
+ const schema = MODEL_REGISTRY[kind]?.[model]?.params.aspect_ratio;
1625
+ return schema?.kind === "string" ? schema.enum : void 0;
1626
+ }
1627
+ function ratioValue(ratio) {
1628
+ const [w, h] = ratio.split(":").map(Number);
1629
+ if (!w || !h || !Number.isFinite(w) || !Number.isFinite(h)) return null;
1630
+ return w / h;
1631
+ }
1632
+ function nearestSupportedAspectRatio(kind, model, target) {
1633
+ const supported = supportedAspectRatios(kind, model);
1634
+ if (!supported || supported.includes(target)) return target;
1635
+ const wanted = ratioValue(target);
1636
+ if (wanted === null) return target;
1637
+ let best = target;
1638
+ let bestDistance = Number.POSITIVE_INFINITY;
1639
+ for (const candidate of supported) {
1640
+ const value = ratioValue(candidate);
1641
+ if (value === null) continue;
1642
+ const distance2 = Math.abs(Math.log(value / wanted));
1643
+ if (distance2 < bestDistance) {
1644
+ bestDistance = distance2;
1645
+ best = candidate;
1646
+ }
1647
+ }
1648
+ return best;
1649
+ }
1610
1650
 
1611
1651
  // ../canvas-contract/src/validateParams.ts
1612
1652
  function isManagedNodeKind(nodeType) {
@@ -6991,8 +7031,9 @@ var dialogueNode = delegated({
6991
7031
  // src/engine/nodes/remote/image.ts
6992
7032
  import { z as z17 } from "zod";
6993
7033
  var IMAGE_GENERATE_MODELS2 = [
7034
+ "openai/gpt-image-2",
7035
+ // Legacy — see the registry entry; kept so pre-switch canvases still run.
6994
7036
  "openai/gpt-5.4-image-2",
6995
- "google/gemini-3.5-flash",
6996
7037
  "google/gemini-3.1-flash-image-preview",
6997
7038
  "google/gemini-3-pro-image-preview",
6998
7039
  "recraft/recraft-v4.1-pro-vector"
@@ -7002,11 +7043,11 @@ var ImageGenerateParams = z17.object({
7002
7043
  prompt: z17.string().min(1),
7003
7044
  aspect_ratio: z17.enum(["1:1", "16:9", "9:16", "4:3", "3:4", "3:2", "2:3", "4:5", "5:4", "21:9", "1:4", "4:1", "1:8", "8:1"]).optional(),
7004
7045
  image_size: z17.enum(["0.5K", "1K", "2K", "4K"]).optional(),
7005
- // Rendering quality forwarded into `image_config`. OpenRouter models without a
7006
- // quality knob ignore it; the registry gates which models accept it (gpt-image, Gemini).
7046
+ // Rendering quality. OpenRouter models without a quality knob ignore it; the
7047
+ // registry gates which models accept it (gpt-image, Gemini).
7007
7048
  quality: z17.enum(["auto", "low", "medium", "high"]).optional(),
7008
- // Recraft v4 vector controls forwarded into `image_config`. Registry
7009
- // rejects them on non-Recraft models.
7049
+ // Recraft v4 vector controls, sent as the provider's own `controls` block.
7050
+ // Registry rejects them on non-Recraft models.
7010
7051
  strength: z17.number().min(0).max(1).optional(),
7011
7052
  rgb_colors: z17.array(z17.array(z17.number().int().min(0).max(255))).optional(),
7012
7053
  background_rgb_color: z17.array(z17.number().int().min(0).max(255)).optional()
@@ -7015,8 +7056,8 @@ var imageGenerateNode = delegated({
7015
7056
  id: "image_generate",
7016
7057
  version: "2.2.0",
7017
7058
  category: "image",
7018
- summary: "Generate images for ad creatives. Curated model set: GPT-5.4 Image, Gemini 3.5 Flash, Gemini 3.1 Flash Image Preview, Gemini 3 Pro Image, Recraft v4.1 Pro Vector. Per-model param support comes from the canvas-engine model registry.",
7019
- when_to_use: "Use for hero shots, product photography, illustrations, and vector logos. `recraft/recraft-v4.1-pro-vector` for crisp vector / logo work; `openai/gpt-5.4-image-2` for photorealistic; Gemini variants for fast iteration and editing via the `reference` input. `reference` accepts ONE image or an ARRAY of images \u2014 wire several to combine references in a single generation (e.g. a subject sheet + a font specimen + the original ad). Every reference is forwarded to the model in array order.",
7059
+ summary: "Generate images for ad creatives. Curated model set: GPT Image 2, Gemini 3.1 Flash Image Preview, Gemini 3 Pro Image, Recraft v4.1 Pro Vector. Per-model param support comes from the canvas-engine model registry.",
7060
+ when_to_use: "Use for hero shots, product photography, illustrations, and vector logos. `recraft/recraft-v4.1-pro-vector` for crisp vector / logo work; `openai/gpt-image-2` for photorealistic and in-image text (NOTE: it has no `image_size`, and no 4:5 / 5:4 \u2014 route portrait ad formats through Gemini or `image_aspect_adapt`); Gemini variants for fast iteration, extreme ratios, and editing via the `reference` input. `reference` accepts ONE image or an ARRAY of images \u2014 wire several to combine references in a single generation (e.g. a subject sheet + a font specimen + the original ad). Every reference is forwarded to the model in array order.",
7020
7061
  // `reference` is one image or an ordered array of images. The backend forwards
7021
7062
  // each as a separate `image_url` to the provider (OpenRouter accepts many).
7022
7063
  inputs: z17.object({ reference: z17.union([ImageRef, z17.array(ImageRef).min(1)]).optional() }).loose(),
@@ -7872,6 +7913,8 @@ export {
7872
7913
  IMAGE_GENERATE_MODELS,
7873
7914
  DEFAULT_VIDEO_GENERATE_MODEL,
7874
7915
  MODEL_REGISTRY,
7916
+ supportsParam,
7917
+ nearestSupportedAspectRatio,
7875
7918
  resolveConcurrency,
7876
7919
  ulid,
7877
7920
  isPersistedAssetRef,
@@ -7898,4 +7941,4 @@ export {
7898
7941
  defaultRegistry,
7899
7942
  createEngineFromEnv
7900
7943
  };
7901
- //# sourceMappingURL=chunk-2F5SCTNS.js.map
7944
+ //# sourceMappingURL=chunk-OO5BDH3J.js.map