@howells/motif-sdk 1.3.0 → 2.0.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
@@ -171,12 +171,29 @@ Four providers are implemented, each reading its own API key from the environmen
171
171
  | Provider | Env var | Notes |
172
172
  | --- | --- | --- |
173
173
  | `google` | `GOOGLE_GENERATIVE_AI_API_KEY` | Default provider; Gemini gen + edit |
174
- | `openai` | `OPENAI_API_KEY` | gpt-image-1 |
174
+ | `openai` | `OPENAI_API_KEY` | GPT Image 2.5 Flare (fast/balanced), Sunburst (quality/hero) |
175
175
  | `replicate` | `REPLICATE_API_TOKEN` | flux-1.1-pro-ultra |
176
176
  | `fal` | `FAL_KEY` | fal-hosted adapter |
177
177
 
178
178
  `generate()` and `edit()` accept `tier` (`"fast" | "balanced" | "quality" | "hero"`) to resolve a model per provider, or an explicit `model` id. Every result carries a normalized per-call `cost: { usd, source }`.
179
179
 
180
+ For OpenAI, `fast` and `balanced` (the default tier) select `gpt-image-2.5-flare`; `quality` and `hero` select `gpt-image-2.5-sunburst`. This updates the previous OpenAI tier default of `gpt-image-1`; pass that explicit model to retain it. Both new models support generation and multi-image editing:
181
+
182
+ ```ts
183
+ const image = createMotifImage({ defaultProvider: "openai" });
184
+ const generated = await image.generate({
185
+ prompt: "A ceramic vase in soft window light",
186
+ model: "gpt-image-2.5-flare",
187
+ });
188
+ const refined = await image.edit({
189
+ images: [referenceBytes],
190
+ instruction: "Change only the vase glaze to deep green",
191
+ model: "gpt-image-2.5-sunburst",
192
+ });
193
+ ```
194
+
195
+ These models use token-based billing. Motif has no static per-image estimate for them, so `cost` is `{ usd: 0, source: "unknown" }` unless the provider supplies a cost; this does not mean generation is free. See the official [Flare](https://developers.openai.com/api/docs/models/gpt-image-2.5-flare) and [Sunburst](https://developers.openai.com/api/docs/models/gpt-image-2.5-sunburst) model pages. The installed OpenAI adapter accepts `low`, `medium`, `high`, and `auto` quality; the new `xhigh` and `max` settings require a future adapter update. The fal-backed CLI and `FalClient` expose these models as `flare` and `sunburst`. Fal supports `xhigh` and `max`, up to 16 edit references, masks and transparent backgrounds. Fal generation estimates are `null` (metered), including `estimateCost()` and queued jobs.
196
+
180
197
  ### Best-of-N with an injectable judge
181
198
 
182
199
  `bestOfN()` generates `n` candidates in parallel and picks a winner. It reuses the same options as `generate()` (text→image) or `edit()` (pass `images` for the edit path), plus `n` and an optional `judge`. When a `seed` is given each candidate uses `seed + index`, so the N vary. The judge is a caller-provided function — the layer takes no text-client dependency, so it pairs well with `@howells/ai`'s vision client but does not require it. Omit the judge and candidate 0 wins.