@pixerate/editor 0.223.5 → 0.223.7

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.
Files changed (23) hide show
  1. package/dist/tools/skill-evals.d.cts +26 -1
  2. package/dist/tools/skill-evals.d.ts +26 -1
  3. package/package.json +1 -1
  4. package/skills/README.md +7 -1
  5. package/skills/pixerate-animation-editor/SKILL.md +8 -0
  6. package/skills/pixerate-animation-logo-reveal/SKILL.md +103 -0
  7. package/skills/pixerate-animation-logo-reveal/evals/draw-then-word.json +77 -0
  8. package/skills/pixerate-animation-logo-reveal/evals/hold-the-end.json +76 -0
  9. package/skills/pixerate-animation-logo-reveal/evals/on-the-beat.json +106 -0
  10. package/skills/pixerate-animation-motion-graphics/SKILL.md +100 -0
  11. package/skills/pixerate-animation-motion-graphics/evals/fit-length.json +109 -0
  12. package/skills/pixerate-animation-motion-graphics/evals/natural-easing.json +96 -0
  13. package/skills/pixerate-animation-motion-graphics/evals/staggered-entrance.json +69 -0
  14. package/skills/pixerate-effect-authoring/SKILL.md +7 -0
  15. package/skills/pixerate-effect-look-development/SKILL.md +96 -0
  16. package/skills/pixerate-effect-look-development/evals/fade-in.json +55 -0
  17. package/skills/pixerate-effect-look-development/evals/seamless-loop.json +66 -0
  18. package/skills/pixerate-effect-look-development/evals/subtle-preset.json +49 -0
  19. package/skills/pixerate-generation/SKILL.md +7 -0
  20. package/skills/pixerate-generation-budgeted-batch/SKILL.md +99 -0
  21. package/skills/pixerate-generation-budgeted-batch/evals/drafts-within-budget.json +101 -0
  22. package/skills/pixerate-generation-budgeted-batch/evals/right-model-for-format.json +124 -0
  23. package/skills/pixerate-generation-budgeted-batch/evals/vary-earlier.json +101 -0
@@ -0,0 +1,109 @@
1
+ {
2
+ "prompt": "This animation needs to be exactly 4 seconds long for the ad slot. Keep the pacing natural.",
3
+ "fixture": {
4
+ "editor": "animation",
5
+ "setup": [
6
+ {
7
+ "tool": "set_animation_artwork_svg",
8
+ "args": {
9
+ "svg": "<svg viewBox=\"0 0 200 100\"><rect id=\"bar1\" x=\"20\" y=\"20\" width=\"20\" height=\"60\"/><rect id=\"bar2\" x=\"60\" y=\"20\" width=\"20\" height=\"60\"/><rect id=\"bar3\" x=\"100\" y=\"20\" width=\"20\" height=\"60\"/></svg>"
10
+ }
11
+ },
12
+ {
13
+ "tool": "insert_shots",
14
+ "args": {
15
+ "shots": [
16
+ {
17
+ "id": "intro",
18
+ "run": [
19
+ {
20
+ "type": "enter",
21
+ "targets": [
22
+ "bar1",
23
+ "bar2",
24
+ "bar3"
25
+ ],
26
+ "stagger": 200
27
+ }
28
+ ],
29
+ "hold": 600
30
+ },
31
+ {
32
+ "id": "middle",
33
+ "run": [
34
+ {
35
+ "type": "move",
36
+ "targets": [
37
+ "bar2"
38
+ ],
39
+ "by": {
40
+ "x": 0,
41
+ "y": -20
42
+ }
43
+ }
44
+ ],
45
+ "hold": 1500
46
+ },
47
+ {
48
+ "id": "end",
49
+ "run": [
50
+ {
51
+ "type": "exit",
52
+ "targets": [
53
+ "bar1",
54
+ "bar2",
55
+ "bar3"
56
+ ]
57
+ }
58
+ ],
59
+ "hold": 1000
60
+ }
61
+ ]
62
+ }
63
+ }
64
+ ]
65
+ },
66
+ "checks": [
67
+ {
68
+ "why": "exactly 4 seconds",
69
+ "tool": "get_animation",
70
+ "expect": {
71
+ "duration": {
72
+ "$min": 3980,
73
+ "$max": 4020
74
+ }
75
+ }
76
+ },
77
+ {
78
+ "why": "the same shots, in order",
79
+ "tool": "get_animation",
80
+ "expect": {
81
+ "shots": {
82
+ "$expr": "v.map((s) => s.id).join() === 'intro,middle,end'"
83
+ }
84
+ }
85
+ },
86
+ {
87
+ "why": "no errors or warnings in the check",
88
+ "tool": "check_animation",
89
+ "expect": {
90
+ "errors": 0,
91
+ "warnings": 0
92
+ }
93
+ }
94
+ ],
95
+ "solution": [
96
+ {
97
+ "tool": "get_animation"
98
+ },
99
+ {
100
+ "tool": "fit_animation",
101
+ "args": {
102
+ "seconds": 4
103
+ }
104
+ },
105
+ {
106
+ "tool": "check_animation"
107
+ }
108
+ ]
109
+ }
@@ -0,0 +1,96 @@
1
+ {
2
+ "prompt": "The bar's slide across looks mechanical. Make the movement feel natural.",
3
+ "fixture": {
4
+ "editor": "animation",
5
+ "setup": [
6
+ {
7
+ "tool": "set_animation_artwork_svg",
8
+ "args": {
9
+ "svg": "<svg viewBox=\"0 0 200 100\"><rect id=\"bar1\" x=\"20\" y=\"20\" width=\"20\" height=\"60\"/><rect id=\"bar2\" x=\"60\" y=\"20\" width=\"20\" height=\"60\"/><rect id=\"bar3\" x=\"100\" y=\"20\" width=\"20\" height=\"60\"/></svg>"
10
+ }
11
+ },
12
+ {
13
+ "tool": "insert_shots",
14
+ "args": {
15
+ "shots": [
16
+ {
17
+ "id": "slide",
18
+ "run": [
19
+ {
20
+ "type": "move",
21
+ "targets": [
22
+ "bar1"
23
+ ],
24
+ "by": {
25
+ "x": 60,
26
+ "y": 0
27
+ },
28
+ "ease": "linear"
29
+ }
30
+ ]
31
+ }
32
+ ]
33
+ }
34
+ }
35
+ ]
36
+ },
37
+ "checks": [
38
+ {
39
+ "why": "the move eases instead of running at constant speed",
40
+ "tool": "get_animation",
41
+ "expect": {
42
+ "shots": {
43
+ "$some": {
44
+ "id": "slide",
45
+ "commands": {
46
+ "$some": {
47
+ "type": "move",
48
+ "$expr": "v.ease !== 'linear'"
49
+ }
50
+ }
51
+ }
52
+ }
53
+ }
54
+ },
55
+ {
56
+ "why": "it still slides the same distance",
57
+ "tool": "get_animation",
58
+ "expect": {
59
+ "shots": {
60
+ "$some": {
61
+ "id": "slide",
62
+ "commands": {
63
+ "$some": {
64
+ "type": "move",
65
+ "by": {
66
+ "x": 60,
67
+ "y": 0
68
+ }
69
+ }
70
+ }
71
+ }
72
+ }
73
+ }
74
+ },
75
+ {
76
+ "why": "no errors or warnings in the check",
77
+ "tool": "check_animation",
78
+ "expect": {
79
+ "errors": 0,
80
+ "warnings": 0
81
+ }
82
+ }
83
+ ],
84
+ "solution": [
85
+ {
86
+ "tool": "update_command",
87
+ "args": {
88
+ "shot": "slide",
89
+ "command": 0,
90
+ "set": {
91
+ "ease": "ease-in-out"
92
+ }
93
+ }
94
+ }
95
+ ]
96
+ }
@@ -0,0 +1,69 @@
1
+ {
2
+ "prompt": "Animate the three bars coming in one after another with a short, snappy stagger, then hold on all three.",
3
+ "fixture": {
4
+ "editor": "animation",
5
+ "setup": [
6
+ {
7
+ "tool": "set_animation_artwork_svg",
8
+ "args": {
9
+ "svg": "<svg viewBox=\"0 0 200 100\"><rect id=\"bar1\" x=\"20\" y=\"20\" width=\"20\" height=\"60\"/><rect id=\"bar2\" x=\"60\" y=\"20\" width=\"20\" height=\"60\"/><rect id=\"bar3\" x=\"100\" y=\"20\" width=\"20\" height=\"60\"/></svg>"
10
+ }
11
+ }
12
+ ]
13
+ },
14
+ "checks": [
15
+ {
16
+ "why": "each bar enters, at a different time, within about half a second of each other",
17
+ "tool": "get_animation",
18
+ "expect": {
19
+ "$expr": "(() => { const starts = {}; for (const s of v.shots) for (const c of s.commands) if (c.type === 'enter') c.targets.forEach((t, i) => { starts[t] = c.start + (c.delay || 0) + i * (c.stagger || 0); }); const xs = ['bar1', 'bar2', 'bar3'].map((b) => starts[b]); return xs.every((x) => x !== undefined) && new Set(xs).size === 3 && Math.max(...xs) - Math.min(...xs) <= 600; })()"
20
+ }
21
+ },
22
+ {
23
+ "why": "it ends holding on the bars",
24
+ "tool": "get_animation",
25
+ "expect": {
26
+ "shots": {
27
+ "$expr": "(() => { const s = v[v.length - 1]; return s.end - Math.max(...s.commands.map((c) => c.end)) >= 300; })()"
28
+ }
29
+ }
30
+ },
31
+ {
32
+ "why": "no errors or warnings in the check",
33
+ "tool": "check_animation",
34
+ "expect": {
35
+ "errors": 0,
36
+ "warnings": 0
37
+ }
38
+ }
39
+ ],
40
+ "solution": [
41
+ {
42
+ "tool": "insert_shots",
43
+ "args": {
44
+ "shots": [
45
+ {
46
+ "id": "bars",
47
+ "label": "Bars enter",
48
+ "run": [
49
+ {
50
+ "type": "enter",
51
+ "targets": [
52
+ "bar1",
53
+ "bar2",
54
+ "bar3"
55
+ ],
56
+ "style": "rise",
57
+ "stagger": 120
58
+ }
59
+ ],
60
+ "hold": 800
61
+ }
62
+ ]
63
+ }
64
+ },
65
+ {
66
+ "tool": "check_animation"
67
+ }
68
+ ]
69
+ }
@@ -17,6 +17,13 @@ preview frames.
17
17
 
18
18
  For general error reporting and undo conventions, see `pixerate-agent-tools`.
19
19
 
20
+ ## Workflow skills
21
+
22
+ For these jobs, load the workflow skill too: it has the method, the checks between steps and
23
+ the pitfalls, and uses the tools below.
24
+
25
+ - `pixerate-effect-look-development`: tune a look, save presets, eased keyframes, seamless loops.
26
+
20
27
  ## Working method
21
28
 
22
29
  1. **Inspect first.** Run `effect_authoring_describe` to inspect the effect name, kind, source
@@ -0,0 +1,96 @@
1
+ ---
2
+ name: pixerate-effect-look-development
3
+ description: The look development workflow for Pixerate effects - reading an effect's controls, finding the look with a few deliberate value changes, saving looks as named presets, animating controls with keyframes and easing, setting duration and looping for seamless cycles, previewing at key moments, and editing shader source only when controls cannot get there. Use when asked to design, tune, tweak or animate an effect, shader, filter or procedural look, make a preset or variant of a look, make an effect fade in or out, pulse or loop, or when effect_authoring_describe, effect_authoring_set_values, effect_authoring_set_keyframe or effect_authoring_save_preset are available. Load with pixerate-effect-authoring, which lists every tool.
4
+ metadata:
5
+ kind: workflow
6
+ reference: pixerate-effect-authoring
7
+ ---
8
+
9
+ # Developing a look
10
+
11
+ An effect is a set of controls over a shader or procedure. A look is a set of values for those
12
+ controls, kept as a named preset; an animated look adds keyframed tracks over a duration. Find
13
+ the look with a few deliberate moves (start from a preset, change one control at a time, look),
14
+ save it, and animate only what should change over time.
15
+
16
+ This skill is the method. `pixerate-effect-authoring` has the full tool reference.
17
+
18
+ ## Goal and quality bar
19
+
20
+ - Every value is within its control's range (`effect_authoring_describe` lists `min`, `max`,
21
+ `default`).
22
+ - The look is saved as a preset with a clear name, so it can be applied again.
23
+ - Animation uses as few keyframes as the motion needs, with easing (`ease-out` to arrive,
24
+ `ease-in-out` for a pulse); duration fits the use.
25
+ - A loop is seamless: `loop` on, and the animated values match at the start and the end.
26
+ - `issues` is empty and `previewError` is null.
27
+
28
+ ## Inputs to confirm
29
+
30
+ - **The look** in words (subtle, strong, warm, glitchy) or a reference.
31
+ - **Static or animated**, and the duration and looping for animation.
32
+ - **Whether to keep** the result as a preset, and its name.
33
+
34
+ ## Working method
35
+
36
+ 1. **Read.** `effect_authoring_describe`: controls with ranges and defaults, current values,
37
+ presets, tracks, duration, loop, issues.
38
+ **Check:** you know which control does what.
39
+ 2. **Start close.** `effect_authoring_apply_preset` when a preset is near the look;
40
+ `effect_authoring_reset_values` to start clean.
41
+ 3. **Tune.** `effect_authoring_set_values` with only the controls you change, a few at a time;
42
+ `effect_authoring_view` to look.
43
+ **Check:** `values` in `effect_authoring_describe` are what you set; no `issues`.
44
+ 4. **Save.** `effect_authoring_save_preset` with a descriptive `name` ("Subtle", "Warm glow").
45
+ **Check:** the name is in `presets`.
46
+ 5. **Animate.** `effect_authoring_set_timing` for `duration` and `loop`; then
47
+ `effect_authoring_set_keyframe` per control at the times that matter, with `easing` into the
48
+ next keyframe. For a loop, the last keyframe's value equals the first's.
49
+ **Check:** `tracks` list the control with the keyframe count you meant.
50
+ 6. **Preview** with `effect_authoring_seek` to key times and `effect_authoring_view`.
51
+ 7. **Source last.** `effect_authoring_get_source` / `effect_authoring_set_source` only when no
52
+ control can produce the look; read the returned issues and fix them.
53
+
54
+ ## Decision table
55
+
56
+ | Want | Approach |
57
+ | --- | --- |
58
+ | A softer or stronger version of a look | Scale the main control (strength, amount); save as a preset |
59
+ | A starting point | `effect_authoring_apply_preset` |
60
+ | Back to defaults | `effect_authoring_reset_values` |
61
+ | Fade in | Keyframes from the neutral value to the look, `ease-out` |
62
+ | Pulse or breathe | Three keyframes (rest, peak, rest), `ease-in-out`, loop on |
63
+ | A one-off change at a moment | Two keyframes around the moment |
64
+ | Remove animation from a control | `effect_authoring_clear_track` |
65
+ | Something no control does | Edit the source |
66
+
67
+ ## Recipes
68
+
69
+ **Quarter-strength preset.** `effect_authoring_set_values` `{ values: { amount: 0.25 } }` →
70
+ `effect_authoring_save_preset` `{ name: "Subtle" }`.
71
+
72
+ **Fade in over 1.5 s in a 2 s effect.** `effect_authoring_set_timing` `{ duration: 2000 }` →
73
+ `effect_authoring_set_keyframe` `{ control: "amount", time: 0, value: 0 }` → `{ control:
74
+ "amount", time: 1500, value: 1, easing: "ease-out" }`.
75
+
76
+ **Seamless 3 s pulse.** `effect_authoring_set_timing` `{ duration: 3000, loop: true }` → keyframes
77
+ at 0 (0), 1500 (1, `ease-in-out`) and 3000 (0, `ease-in-out`).
78
+
79
+ ## Pitfalls
80
+
81
+ - **Values out of range** are clamped or refused; read the control's `min` and `max`.
82
+ - **Many keyframes** where three would do make motion lumpy and hard to edit.
83
+ - **Linear easing** on organic motion looks mechanical.
84
+ - **Loops that jump**: the end value must equal the start value.
85
+ - **Overwriting a preset** by saving under an existing name; choose a new name unless replacing
86
+ is intended.
87
+ - **Editing source first**: controls are safer and keep presets working.
88
+
89
+ ## Tools used
90
+
91
+ - `effect_authoring_describe`, `effect_authoring_view`, `effect_authoring_seek`: read, look and preview
92
+ - `effect_authoring_set_values`, `effect_authoring_reset_values`, `effect_authoring_apply_preset`: find the look
93
+ - `effect_authoring_save_preset`: keep the look
94
+ - `effect_authoring_set_timing`, `effect_authoring_set_keyframe`, `effect_authoring_remove_keyframe`, `effect_authoring_clear_track`: animate
95
+ - `effect_authoring_get_source`, `effect_authoring_set_source`: edit the shader when needed
96
+ - `effect_authoring_undo`, `effect_authoring_redo`: take back a step
@@ -0,0 +1,55 @@
1
+ {
2
+ "prompt": "Animate the effect fading in: no effect at the start, full strength by 1.5 seconds, in a 2-second effect.",
3
+ "fixture": {
4
+ "editor": "effect",
5
+ "effectId": "fake.invert"
6
+ },
7
+ "checks": [
8
+ {
9
+ "why": "a 2-second effect",
10
+ "tool": "effect_authoring_describe",
11
+ "expect": {
12
+ "duration": 2000
13
+ }
14
+ },
15
+ {
16
+ "why": "the amount is keyframed (at least a start and an end)",
17
+ "tool": "effect_authoring_describe",
18
+ "expect": {
19
+ "tracks": {
20
+ "$some": {
21
+ "control": "amount",
22
+ "keyframes": {
23
+ "$min": 2
24
+ }
25
+ }
26
+ }
27
+ }
28
+ }
29
+ ],
30
+ "solution": [
31
+ {
32
+ "tool": "effect_authoring_set_timing",
33
+ "args": {
34
+ "duration": 2000
35
+ }
36
+ },
37
+ {
38
+ "tool": "effect_authoring_set_keyframe",
39
+ "args": {
40
+ "control": "amount",
41
+ "time": 0,
42
+ "value": 0
43
+ }
44
+ },
45
+ {
46
+ "tool": "effect_authoring_set_keyframe",
47
+ "args": {
48
+ "control": "amount",
49
+ "time": 1500,
50
+ "value": 1,
51
+ "easing": "ease-out"
52
+ }
53
+ }
54
+ ]
55
+ }
@@ -0,0 +1,66 @@
1
+ {
2
+ "prompt": "Make this a seamless 3-second loop that pulses: the amount goes from 0 up to 1 and back to 0 by the end.",
3
+ "fixture": {
4
+ "editor": "effect",
5
+ "effectId": "fake.invert"
6
+ },
7
+ "checks": [
8
+ {
9
+ "why": "3 seconds, looping",
10
+ "tool": "effect_authoring_describe",
11
+ "expect": {
12
+ "duration": 3000,
13
+ "loop": true
14
+ }
15
+ },
16
+ {
17
+ "why": "keyframes at the start, the peak and the end",
18
+ "tool": "effect_authoring_describe",
19
+ "expect": {
20
+ "tracks": {
21
+ "$some": {
22
+ "control": "amount",
23
+ "keyframes": {
24
+ "$min": 3
25
+ }
26
+ }
27
+ }
28
+ }
29
+ }
30
+ ],
31
+ "solution": [
32
+ {
33
+ "tool": "effect_authoring_set_timing",
34
+ "args": {
35
+ "duration": 3000,
36
+ "loop": true
37
+ }
38
+ },
39
+ {
40
+ "tool": "effect_authoring_set_keyframe",
41
+ "args": {
42
+ "control": "amount",
43
+ "time": 0,
44
+ "value": 0
45
+ }
46
+ },
47
+ {
48
+ "tool": "effect_authoring_set_keyframe",
49
+ "args": {
50
+ "control": "amount",
51
+ "time": 1500,
52
+ "value": 1,
53
+ "easing": "ease-in-out"
54
+ }
55
+ },
56
+ {
57
+ "tool": "effect_authoring_set_keyframe",
58
+ "args": {
59
+ "control": "amount",
60
+ "time": 3000,
61
+ "value": 0,
62
+ "easing": "ease-in-out"
63
+ }
64
+ }
65
+ ]
66
+ }
@@ -0,0 +1,49 @@
1
+ {
2
+ "prompt": "Make a subtle version of this invert look, at about a quarter strength, and save it as a preset called 'Subtle'.",
3
+ "fixture": {
4
+ "editor": "effect",
5
+ "effectId": "fake.invert"
6
+ },
7
+ "checks": [
8
+ {
9
+ "why": "about a quarter strength",
10
+ "tool": "effect_authoring_describe",
11
+ "expect": {
12
+ "values": {
13
+ "amount": {
14
+ "$min": 0.15,
15
+ "$max": 0.35
16
+ }
17
+ }
18
+ }
19
+ },
20
+ {
21
+ "why": "saved as a preset named Subtle",
22
+ "tool": "effect_authoring_describe",
23
+ "expect": {
24
+ "presets": {
25
+ "$some": "Subtle"
26
+ }
27
+ }
28
+ }
29
+ ],
30
+ "solution": [
31
+ {
32
+ "tool": "effect_authoring_describe"
33
+ },
34
+ {
35
+ "tool": "effect_authoring_set_values",
36
+ "args": {
37
+ "values": {
38
+ "amount": 0.25
39
+ }
40
+ }
41
+ },
42
+ {
43
+ "tool": "effect_authoring_save_preset",
44
+ "args": {
45
+ "name": "Subtle"
46
+ }
47
+ }
48
+ ]
49
+ }
@@ -20,6 +20,13 @@ See `pixerate-agent-tools` for errors and namespacing.
20
20
  `background_ref`, `mask`, `image_ref`, `video_ref`, `audio_ref`, plus any role a model
21
21
  declares; each model lists the roles it accepts and their min/max counts.
22
22
 
23
+ ## Workflow skills
24
+
25
+ For these jobs, load the workflow skill too: it has the method, the checks between steps and
26
+ the pitfalls, and uses the tools below.
27
+
28
+ - `pixerate-generation-budgeted-batch`: the right model, plan and estimate first, drafts cheap, finals once, variations.
29
+
23
30
  ## Working method
24
31
 
25
32
  1. **Discover.** `list_models` (filter with `media`) and read each candidate's `requestSchema`:
@@ -0,0 +1,99 @@
1
+ ---
2
+ name: pixerate-generation-budgeted-batch
3
+ description: The budgeted generation workflow with Pixerate's AI generation tools - choosing a model that supports the format, planning and estimating before spending, getting approval for cost, drafting cheap and finishing expensive, generating once with an idempotency key, retrying safely, reviewing results, and redoing or varying an earlier generation from the history. Use when asked to generate, render or create images, video, audio or text with AI, make several options or variations, work within a budget or quota, redo or vary an earlier result, or batch generations, or when plan_generation, estimate_generation, generate or vary_generation are available. Load with pixerate-generation, which lists every tool.
4
+ metadata:
5
+ kind: workflow
6
+ reference: pixerate-generation
7
+ ---
8
+
9
+ # Generating within a budget
10
+
11
+ Generation costs money and cannot be undone, so every spend is planned: a model that supports
12
+ what the deliverable needs, a request the planner accepts without silent changes, an estimate
13
+ the user has agreed to, then one `generate` with an idempotency key. Explore at low cost, and
14
+ spend on quality only for the result that will be used.
15
+
16
+ This skill is the method. `pixerate-generation` has the full tool reference and request fields.
17
+
18
+ ## Goal and quality bar
19
+
20
+ - The model supports the deliverable as asked (aspect ratio, resolution, duration, references):
21
+ `plan_generation` shows no `adjustments` that change what the user wanted.
22
+ - The cost is known before spending (`estimate_generation`) and within the user's budget or
23
+ approved; a batch, a high count, long video or the top quality tier is always confirmed.
24
+ - Exactly the generations intended: one `generate` per intended result, each with its own
25
+ `idempotencyKey`; a retry reuses the key.
26
+ - Drafts are cheap (low `quality`, small `resolution`, several in one request with `count`);
27
+ finals are at the quality the use needs.
28
+ - Redos and variations start from the history (`vary_generation`, `recreate_generation`) so
29
+ prompt, seed and settings carry over.
30
+
31
+ ## Inputs to confirm
32
+
33
+ - **The deliverable:** where it will be used (banner 16:9, story 9:16, thumbnail 1:1), how many
34
+ results, the medium.
35
+ - **Budget** or quota, and whether drafts or finals are wanted.
36
+ - **References** (style, character, start frame) and how strictly they must be followed.
37
+
38
+ ## Working method
39
+
40
+ 1. **Discover.** `list_models` (with `media`), and read each candidate's `requestSchema`.
41
+ **Check:** at least one model supports the format and references; pick it by schema, never
42
+ by name.
43
+ 2. **Plan.** `plan_generation` with the request; read every `adjustments` and `errors` entry.
44
+ Use `strategy: "error"` (or `upgrade`) when exact settings matter.
45
+ **Check:** `ok: true` and no adjustment that changes the deliverable; otherwise another model.
46
+ 3. **Estimate.** `estimate_generation` with the same arguments; compare alternatives (fewer
47
+ outputs, lower quality, smaller size) against the budget.
48
+ **Check:** the cost fits the budget, or the user has approved it.
49
+ 4. **Generate once.** `generate` with the same `model`, `request`, `strategy` and a fresh,
50
+ descriptive `idempotencyKey`. On a timeout or transport error, call again with the identical
51
+ arguments and the same key.
52
+ **Check:** `list_generations` shows one new record per intended result.
53
+ 5. **Review** the results with the user; keep the chosen one's id.
54
+ 6. **Finish or vary.** For the final or a variation, `vary_generation` (or `recreate_generation`)
55
+ from the chosen record with only the changed `settings`; read `drift`; then estimate and
56
+ generate as above.
57
+
58
+ ## Decision table
59
+
60
+ | Situation | Approach |
61
+ | --- | --- |
62
+ | A format only some models support | `list_models`, choose by `requestSchema`, plan with `strategy: "error"` |
63
+ | Several options to choose from | One request with `count`, low `quality` |
64
+ | Tight budget | Estimate alternatives; drafts low, one final high |
65
+ | A result to redo exactly | `recreate_generation`, then `generate` |
66
+ | The same result in another format or size | `vary_generation` with `settings` |
67
+ | A timeout or network error | Retry with identical arguments and the same key |
68
+ | A planner adjustment that changes the brief | Another model, or ask the user |
69
+
70
+ ## Recipes
71
+
72
+ **One 16:9 banner.** `list_models` → `plan_generation` `{ model, request: { prompt,
73
+ aspectRatio: "16:9", count: 1 } }` → `estimate_generation` → `generate` with `strategy:
74
+ "error"` and `idempotencyKey: "banner-lighthouse-1"`.
75
+
76
+ **Four drafts under $1.** `estimate_generation` at `quality: "high"` and `"low"` with `count: 4`
77
+ → pick the one within budget → one `generate`.
78
+
79
+ **The last image, wider.** `list_generations` → `vary_generation` `{ id, settings: {
80
+ aspectRatio: "16:9" } }` → `generate` with the returned `model` and `request`.
81
+
82
+ ## Pitfalls
83
+
84
+ - **Generating to find out what a model supports.** Plan and estimate are free; generate is not.
85
+ - **Silent adjustments** with `nearest`: a different aspect ratio or a dropped reference; read
86
+ `adjustments` before spending.
87
+ - **A new key on retry** pays twice; reuse the key for the same generation.
88
+ - **Separate calls for options** that one request with `count` would make more cheaply.
89
+ - **Finals at draft quality**, or drafts at final quality; match quality to the stage.
90
+ - **Rewriting a prompt by hand** to redo a result loses seed and settings; vary from the history.
91
+
92
+ ## Tools used
93
+
94
+ - `list_models`: models and their request schemas
95
+ - `plan_generation`: check a request and read adjustments
96
+ - `estimate_generation`: cost and time before spending
97
+ - `generate`: the one paid call, with an idempotency key
98
+ - `list_generations`, `get_generation`: the history and a record's details
99
+ - `vary_generation`, `recreate_generation`: redo or vary an earlier result