@howells/motif-sdk 0.10.0 → 0.11.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/dist/image.d.ts CHANGED
@@ -97,6 +97,12 @@ interface GenerateImageOptions {
97
97
  seed?: number;
98
98
  /** Abort signal to cancel the in-flight request. */
99
99
  signal?: AbortSignal;
100
+ /**
101
+ * Extra HTTP headers forwarded to the provider request. Fal's non-retained IO
102
+ * (paired with FalClient.deletePayloads) is
103
+ * `headers: { "X-Fal-Store-IO": "0" }`.
104
+ */
105
+ headers?: Record<string, string>;
100
106
  /**
101
107
  * Provider-specific options, passed straight through to the underlying model
102
108
  * as body parameters. Outer key = provider name, inner key = option name.
@@ -138,6 +144,12 @@ interface EditImageOptions {
138
144
  seed?: number;
139
145
  /** Abort signal to cancel the in-flight request. */
140
146
  signal?: AbortSignal;
147
+ /**
148
+ * Extra HTTP headers forwarded to the provider request. Fal's non-retained IO
149
+ * (paired with FalClient.deletePayloads) is
150
+ * `headers: { "X-Fal-Store-IO": "0" }`.
151
+ */
152
+ headers?: Record<string, string>;
141
153
  /** Provider-specific options (see {@link GenerateImageOptions.providerOptions}). */
142
154
  providerOptions?: Record<string, Record<string, unknown>>;
143
155
  }
@@ -368,7 +380,11 @@ declare const REPLICATE_API_KEY_ENV = "REPLICATE_API_TOKEN";
368
380
  * });
369
381
  */
370
382
 
371
- /** Tier → fal model id. */
383
+ /**
384
+ * Tier → fal model id. For fal, explicit `model:` endpoint ids are the primary
385
+ * path (any fal endpoint resolves via passthrough); this tier map is a
386
+ * convenience covering the two most common (FLUX Pro Ultra + gpt-image).
387
+ */
372
388
  declare const FAL_TIER_MODELS: Readonly<Record<ImageTier, string>>;
373
389
  /** Env var read for the fal key when `apiKey` is not supplied in config. */
374
390
  declare const FAL_API_KEY_ENV = "FAL_KEY";
package/dist/image.js CHANGED
@@ -1291,8 +1291,58 @@ var FAL_TIER_MODELS = {
1291
1291
  };
1292
1292
  var FAL_API_KEY_ENV = "FAL_KEY";
1293
1293
  var FAL_IMAGE_PRICE_USD = {
1294
+ // FLUX family.
1294
1295
  [FAL_FLUX_MODEL]: MODELS.flux?.pricePerImageUsd ?? 0.06,
1295
- [FAL_GPT_IMAGE_MODEL]: MODELS.gpt?.pricePerImageUsd ?? 0.133
1296
+ // MODELS.flux
1297
+ "fal-ai/flux/schnell": MODELS["flux-fast"]?.pricePerImageUsd ?? 3e-3,
1298
+ // MODELS["flux-fast"]
1299
+ // FLUX.2 family.
1300
+ "fal-ai/flux-2-max": MODELS["flux2-max"]?.pricePerImageUsd ?? 0.07,
1301
+ // MODELS["flux2-max"]
1302
+ "fal-ai/flux-2-pro": MODELS["flux2-pro"]?.pricePerImageUsd ?? 0.03,
1303
+ // MODELS["flux2-pro"]
1304
+ "fal-ai/flux-2-flex": MODELS["flux2-flex"]?.pricePerImageUsd ?? 0.05,
1305
+ // MODELS["flux2-flex"]
1306
+ "fal-ai/flux-2": MODELS["flux2-dev"]?.pricePerImageUsd ?? 0.012,
1307
+ // MODELS["flux2-dev"]
1308
+ "fal-ai/flux-2/turbo": MODELS["flux2-turbo"]?.pricePerImageUsd ?? 8e-3,
1309
+ // MODELS["flux2-turbo"]
1310
+ // gpt-image (fal adds overhead vs OpenAI-direct — see design doc §10).
1311
+ [FAL_GPT_IMAGE_MODEL]: MODELS.gpt?.pricePerImageUsd ?? 0.133,
1312
+ // MODELS.gpt
1313
+ "openai/gpt-image-2": MODELS.gpt2?.pricePerImageUsd ?? 0.211,
1314
+ // MODELS.gpt2
1315
+ // Nano Banana (Gemini image) family.
1316
+ "fal-ai/nano-banana-2": MODELS.banana2?.pricePerImageUsd ?? 0.08,
1317
+ // MODELS.banana2
1318
+ "fal-ai/nano-banana-pro": MODELS.banana?.pricePerImageUsd ?? 0.15,
1319
+ // MODELS.banana
1320
+ "fal-ai/gemini-25-flash-image": MODELS.gemini?.pricePerImageUsd ?? 0.0398,
1321
+ // MODELS.gemini
1322
+ "fal-ai/gemini-3-pro-image-preview": MODELS.gemini3?.pricePerImageUsd ?? 0.15,
1323
+ // MODELS.gemini3
1324
+ // Seedream family.
1325
+ "fal-ai/bytedance/seedream/v4/text-to-image": MODELS.seedream4?.pricePerImageUsd ?? 0.03,
1326
+ // MODELS.seedream4
1327
+ "fal-ai/bytedance/seedream/v4.5/text-to-image": MODELS.seedream45?.pricePerImageUsd ?? 0.04,
1328
+ // MODELS.seedream45
1329
+ "bytedance/seedream/v5/pro/text-to-image": MODELS.seedream5?.pricePerImageUsd ?? 0.0675,
1330
+ // MODELS.seedream5
1331
+ "fal-ai/bytedance/seedream/v5/lite/text-to-image": MODELS["seedream5-lite"]?.pricePerImageUsd ?? 0.035,
1332
+ // MODELS["seedream5-lite"]
1333
+ // Other priced fal generation endpoints.
1334
+ "fal-ai/recraft-v3": MODELS.recraft?.pricePerImageUsd ?? 0.04,
1335
+ // MODELS.recraft
1336
+ "fal-ai/recraft/v4/text-to-image": MODELS.recraft4?.pricePerImageUsd ?? 0.04,
1337
+ // MODELS.recraft4
1338
+ "fal-ai/ideogram/v3": MODELS.ideogram?.pricePerImageUsd ?? 0.03,
1339
+ // MODELS.ideogram
1340
+ "ideogram/v4": MODELS.ideogram4?.pricePerImageUsd ?? 0.03,
1341
+ // MODELS.ideogram4
1342
+ "xai/grok-imagine-image": MODELS["grok-image"]?.pricePerImageUsd ?? 0.02,
1343
+ // MODELS["grok-image"]
1344
+ "fal-ai/qwen-image": MODELS.qwen?.pricePerImageUsd ?? 0.02
1345
+ // MODELS.qwen
1296
1346
  };
1297
1347
  function resolveModel(modelId, apiKey) {
1298
1348
  const key = apiKey ?? process.env[FAL_API_KEY_ENV];
@@ -1505,6 +1555,7 @@ function createMotifImage(config = {}, deps = {}) {
1505
1555
  ...opts.aspectRatio === void 0 ? {} : { aspectRatio: opts.aspectRatio },
1506
1556
  ...opts.seed === void 0 ? {} : { seed: opts.seed },
1507
1557
  ...opts.signal === void 0 ? {} : { abortSignal: opts.signal },
1558
+ ...opts.headers === void 0 ? {} : { headers: opts.headers },
1508
1559
  ...opts.providerOptions === void 0 ? {} : { providerOptions: toProviderOptions(opts.providerOptions) }
1509
1560
  });
1510
1561
  return ok2(toMotifImageResult(result, provider, modelId));
@@ -1527,6 +1578,7 @@ function createMotifImage(config = {}, deps = {}) {
1527
1578
  ...opts.n === void 0 ? {} : { n: opts.n },
1528
1579
  ...opts.seed === void 0 ? {} : { seed: opts.seed },
1529
1580
  ...opts.signal === void 0 ? {} : { abortSignal: opts.signal },
1581
+ ...opts.headers === void 0 ? {} : { headers: opts.headers },
1530
1582
  ...opts.providerOptions === void 0 ? {} : { providerOptions: toProviderOptions(opts.providerOptions) }
1531
1583
  });
1532
1584
  return ok2(toMotifImageResult(result, provider, modelId));
@@ -1739,7 +1791,8 @@ function toMotifError(error) {
1739
1791
  }
1740
1792
  const message = error instanceof Error ? error.message : String(error);
1741
1793
  const code = error instanceof Error && "code" in error && typeof error.code === "string" ? error.code : void 0;
1742
- return new MotifError(message, 0, code);
1794
+ const status = error instanceof Error && "statusCode" in error && typeof error.statusCode === "number" ? error.statusCode : 0;
1795
+ return new MotifError(message, status, code);
1743
1796
  }
1744
1797
  export {
1745
1798
  FAL_API_KEY_ENV,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@howells/motif-sdk",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "description": "Public Node SDK for Motif fal.ai generation, editing, utility tools, and model metadata.",
5
5
  "keywords": [
6
6
  "fal",