@howells/motif-sdk 0.11.0 → 0.12.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
@@ -14,7 +14,7 @@ declare class MotifError extends Error {
14
14
  * Public types for the provider-agnostic image generation + editing layer
15
15
  * (`@howells/motif-sdk/image`).
16
16
  *
17
- * This layer is additive: it sits alongside the fal-specific `MotifServer`
17
+ * This layer is additive: it sits alongside the fal-specific `FalClient`
18
18
  * surface and reuses the SDK's Result convention (`Result<T, MotifError>` — no
19
19
  * thrown exceptions). See docs/design/provider-agnostic-image-layer.md.
20
20
  */
@@ -364,7 +364,7 @@ declare const REPLICATE_API_KEY_ENV = "REPLICATE_API_TOKEN";
364
364
  * Builds a Vercel AI SDK `ImageModel` from `@ai-sdk/fal`. Building a model
365
365
  * performs no network I/O — the request only happens when `generateImage`
366
366
  * invokes `model.doGenerate`. This is the lightweight fal *image* adapter; the
367
- * richer `MotifServer` fal client (queue, upload, upscale, rmbg, video, tools)
367
+ * richer `FalClient` fal client (queue, upload, upscale, rmbg, video, tools)
368
368
  * is a separate, later fold (design doc §8, phase 1d).
369
369
  *
370
370
  * ENDPOINT QUIRK (Phase 0): fal's gpt-image endpoint wants `image_size` as a
@@ -416,7 +416,7 @@ declare function costForImages(provider: ImageProviderId, modelId: string, provi
416
416
  * `@howells/motif-sdk/image` — provider-agnostic image generation + editing.
417
417
  *
418
418
  * ESM-only subpath export, built on the Vercel AI SDK image interface
419
- * (`generateImage`, `@ai-sdk/*`). Additive to the fal-specific `MotifServer`
419
+ * (`generateImage`, `@ai-sdk/*`). Additive to the fal-specific `FalClient`
420
420
  * surface; reuses the SDK's Result convention (`Result<T, MotifError>` — no
421
421
  * thrown exceptions). Google (Gemini) is the only provider in Phase 1a.
422
422
  *
package/dist/index.cjs CHANGED
@@ -29,6 +29,7 @@ __export(src_exports, {
29
29
  FAL_TOOLS_CHECKED_AT: () => FAL_TOOLS_CHECKED_AT,
30
30
  FAL_TOOL_IDS: () => FAL_TOOL_IDS,
31
31
  FORMAT_PRESETS: () => FORMAT_PRESETS,
32
+ FalClient: () => FalClient,
32
33
  GENERATION_MODELS: () => GENERATION_MODELS,
33
34
  IDEOGRAM_STYLES: () => IDEOGRAM_STYLES,
34
35
  IMAGE_EDITING_TOP_20: () => IMAGE_EDITING_TOP_20,
@@ -2714,7 +2715,7 @@ var FAL_BASE_URL = "https://fal.run";
2714
2715
  var FAL_QUEUE_URL = "https://queue.fal.run";
2715
2716
  var FAL_API_URL = "https://api.fal.ai";
2716
2717
  var FAL_REST_URL = "https://rest.alpha.fal.ai";
2717
- var MotifServer = class {
2718
+ var FalClient = class {
2718
2719
  apiKey;
2719
2720
  timeout;
2720
2721
  retries;
@@ -3236,6 +3237,7 @@ var MotifServer = class {
3236
3237
  });
3237
3238
  }
3238
3239
  };
3240
+ var MotifServer = FalClient;
3239
3241
  var MotifError = class extends Error {
3240
3242
  status;
3241
3243
  code;
@@ -3269,6 +3271,7 @@ function toMotifError(error) {
3269
3271
  FAL_TOOLS_CHECKED_AT,
3270
3272
  FAL_TOOL_IDS,
3271
3273
  FORMAT_PRESETS,
3274
+ FalClient,
3272
3275
  GENERATION_MODELS,
3273
3276
  IDEOGRAM_STYLES,
3274
3277
  IMAGE_EDITING_TOP_20,
package/dist/index.d.cts CHANGED
@@ -388,13 +388,15 @@ interface JobStatus {
388
388
  status: "queued" | "processing" | "completed" | "failed";
389
389
  }
390
390
  /** ─── Configuration ──────────────────────────────────────────── */
391
- interface MotifServerConfig {
391
+ interface FalClientConfig {
392
392
  apiKey: string;
393
393
  /** Max retry attempts for 429/5xx errors (default 3, set 0 to disable) */
394
394
  retries?: number;
395
395
  /** Request timeout in ms (default 120_000) */
396
396
  timeout?: number;
397
397
  }
398
+ /** @deprecated Renamed to {@link FalClientConfig}. */
399
+ type MotifServerConfig = FalClientConfig;
398
400
 
399
401
  /** Ordered by popularity: square first, then common ratios */
400
402
  declare const ASPECT_RATIOS: AspectRatio[];
@@ -475,16 +477,20 @@ declare const RECRAFT_STYLES: readonly ["realistic_image", "realistic_image/b_an
475
477
  declare const IDEOGRAM_STYLES: readonly ["AUTO", "GENERAL", "REALISTIC", "DESIGN"];
476
478
 
477
479
  /**
478
- * Motif Server SDK
480
+ * FalClient — the fal-native client.
481
+ *
482
+ * The low-level, fal-specific client for AI image generation and fal utilities
483
+ * (queue, upload, upscale, rmbg, video, tools, generate). Pairs with the
484
+ * provider-agnostic `createMotifImage` (`@howells/motif-sdk/image`) as the
485
+ * fal-native entry point.
479
486
  *
480
- * Server-side SDK for AI image generation via fal.ai.
481
487
  * All async methods return `Result<T, MotifError>` — no thrown exceptions.
482
488
  *
483
489
  * @example
484
490
  * ```typescript
485
- * import { MotifServer } from "./fal";
491
+ * import { FalClient } from "./fal";
486
492
  *
487
- * const motif = new MotifServer(process.env.FAL_KEY!);
493
+ * const motif = new FalClient(process.env.FAL_KEY!);
488
494
  * const result = await motif.generate({ prompt: "a red balloon", model: "banana" });
489
495
  *
490
496
  * if (result.isOk()) {
@@ -494,11 +500,11 @@ declare const IDEOGRAM_STYLES: readonly ["AUTO", "GENERAL", "REALISTIC", "DESIGN
494
500
  * }
495
501
  * ```
496
502
  */
497
- declare class MotifServer {
503
+ declare class FalClient {
498
504
  private readonly apiKey;
499
505
  private readonly timeout;
500
506
  private readonly retries;
501
- constructor(config: MotifServerConfig | string);
507
+ constructor(config: FalClientConfig | string);
502
508
  /** ─── Synchronous Generation ──────────────────────────────── */
503
509
  /** Generate images synchronously (blocks until fal.ai returns). */
504
510
  generate(options: GenerateOptions): Promise<Result<MotifResponse, MotifError>>;
@@ -924,6 +930,8 @@ declare class MotifServer {
924
930
  */
925
931
  private normalizeResponse;
926
932
  }
933
+ /** @deprecated Renamed to {@link FalClient}. `MotifServer` is kept as an alias for backwards compatibility and will be removed in 1.0. */
934
+ declare const MotifServer: typeof FalClient;
927
935
  declare class MotifError extends Error {
928
936
  readonly status: number;
929
937
  readonly code?: string;
@@ -1320,4 +1328,4 @@ type FalToolId = (typeof FAL_TOOL_IDS)[number];
1320
1328
  declare function isFalToolId(tool: string): tool is FalToolId;
1321
1329
  declare function buildFalToolRequest(options: FalToolRunOptions): FalToolRequest;
1322
1330
 
1323
- export { ASPECT_RATIOS, type AspectRatio, type BackgroundMode, CREATIVE_FIELDS, CREATIVE_TAXONOMY, type CreativeDirection, type CreativeField, type CreativeOption, CreativeOptionError, type CreativeOptionErrorDetails, type CreativePromptResult, type CustomImageSize, EDIT_CAPABLE_MODELS, type EnrichPromptOptions, FAL_TOOLS, FAL_TOOLS_CHECKED_AT, FAL_TOOL_IDS, FORMAT_PRESETS, type FalImageSizePreset, type FalToolConfig, type FalToolId, type FalToolInputKind, type FalToolRequest, type FalToolRunOptions, GENERATION_MODELS, type GenerateOptions, type GenerationModelName, type GptImageSize, IDEOGRAM_STYLES, IMAGE_EDITING_TOP_20, IMAGE_TEXT_TO_IMAGE_TOP_20, type ImageOutputFormat, type ImageQuality, type ImageSize, type JobStatus, type LeaderboardEntry, type LeaderboardSnapshot, MODELS, type ModelConfig, type ModelType, type MotifEnv, MotifError, type MotifImage, type MotifResponse, MotifServer, type MotifServerConfig, type QueuedJob, RECRAFT_STYLES, RESOLUTIONS, type RemoveBackgroundOptions, type Resolution, type SizeMode, type ThinkingLevel, type ToolResponse, type ToolRunOptions, UTILITY_MODELS, type UpscaleOptions, VIDEO_IMAGE_TO_VIDEO_TOP_15, VIDEO_MODELS, VIDEO_TEXT_TO_VIDEO_TOP_15, type VideoOptions, type VideoResponse, aspectToFalImageSize, aspectToGptSize, buildFalToolRequest, buildGenerateBody, enrichPrompt, estimateCost, estimateVideoCost, getFalKeyFromEnv, isFalToolId, motifEnvSchema, parseMotifEnv, sanitizePrompt };
1331
+ export { ASPECT_RATIOS, type AspectRatio, type BackgroundMode, CREATIVE_FIELDS, CREATIVE_TAXONOMY, type CreativeDirection, type CreativeField, type CreativeOption, CreativeOptionError, type CreativeOptionErrorDetails, type CreativePromptResult, type CustomImageSize, EDIT_CAPABLE_MODELS, type EnrichPromptOptions, FAL_TOOLS, FAL_TOOLS_CHECKED_AT, FAL_TOOL_IDS, FORMAT_PRESETS, FalClient, type FalClientConfig, type FalImageSizePreset, type FalToolConfig, type FalToolId, type FalToolInputKind, type FalToolRequest, type FalToolRunOptions, GENERATION_MODELS, type GenerateOptions, type GenerationModelName, type GptImageSize, IDEOGRAM_STYLES, IMAGE_EDITING_TOP_20, IMAGE_TEXT_TO_IMAGE_TOP_20, type ImageOutputFormat, type ImageQuality, type ImageSize, type JobStatus, type LeaderboardEntry, type LeaderboardSnapshot, MODELS, type ModelConfig, type ModelType, type MotifEnv, MotifError, type MotifImage, type MotifResponse, MotifServer, type MotifServerConfig, type QueuedJob, RECRAFT_STYLES, RESOLUTIONS, type RemoveBackgroundOptions, type Resolution, type SizeMode, type ThinkingLevel, type ToolResponse, type ToolRunOptions, UTILITY_MODELS, type UpscaleOptions, VIDEO_IMAGE_TO_VIDEO_TOP_15, VIDEO_MODELS, VIDEO_TEXT_TO_VIDEO_TOP_15, type VideoOptions, type VideoResponse, aspectToFalImageSize, aspectToGptSize, buildFalToolRequest, buildGenerateBody, enrichPrompt, estimateCost, estimateVideoCost, getFalKeyFromEnv, isFalToolId, motifEnvSchema, parseMotifEnv, sanitizePrompt };
package/dist/index.d.ts CHANGED
@@ -388,13 +388,15 @@ interface JobStatus {
388
388
  status: "queued" | "processing" | "completed" | "failed";
389
389
  }
390
390
  /** ─── Configuration ──────────────────────────────────────────── */
391
- interface MotifServerConfig {
391
+ interface FalClientConfig {
392
392
  apiKey: string;
393
393
  /** Max retry attempts for 429/5xx errors (default 3, set 0 to disable) */
394
394
  retries?: number;
395
395
  /** Request timeout in ms (default 120_000) */
396
396
  timeout?: number;
397
397
  }
398
+ /** @deprecated Renamed to {@link FalClientConfig}. */
399
+ type MotifServerConfig = FalClientConfig;
398
400
 
399
401
  /** Ordered by popularity: square first, then common ratios */
400
402
  declare const ASPECT_RATIOS: AspectRatio[];
@@ -475,16 +477,20 @@ declare const RECRAFT_STYLES: readonly ["realistic_image", "realistic_image/b_an
475
477
  declare const IDEOGRAM_STYLES: readonly ["AUTO", "GENERAL", "REALISTIC", "DESIGN"];
476
478
 
477
479
  /**
478
- * Motif Server SDK
480
+ * FalClient — the fal-native client.
481
+ *
482
+ * The low-level, fal-specific client for AI image generation and fal utilities
483
+ * (queue, upload, upscale, rmbg, video, tools, generate). Pairs with the
484
+ * provider-agnostic `createMotifImage` (`@howells/motif-sdk/image`) as the
485
+ * fal-native entry point.
479
486
  *
480
- * Server-side SDK for AI image generation via fal.ai.
481
487
  * All async methods return `Result<T, MotifError>` — no thrown exceptions.
482
488
  *
483
489
  * @example
484
490
  * ```typescript
485
- * import { MotifServer } from "./fal";
491
+ * import { FalClient } from "./fal";
486
492
  *
487
- * const motif = new MotifServer(process.env.FAL_KEY!);
493
+ * const motif = new FalClient(process.env.FAL_KEY!);
488
494
  * const result = await motif.generate({ prompt: "a red balloon", model: "banana" });
489
495
  *
490
496
  * if (result.isOk()) {
@@ -494,11 +500,11 @@ declare const IDEOGRAM_STYLES: readonly ["AUTO", "GENERAL", "REALISTIC", "DESIGN
494
500
  * }
495
501
  * ```
496
502
  */
497
- declare class MotifServer {
503
+ declare class FalClient {
498
504
  private readonly apiKey;
499
505
  private readonly timeout;
500
506
  private readonly retries;
501
- constructor(config: MotifServerConfig | string);
507
+ constructor(config: FalClientConfig | string);
502
508
  /** ─── Synchronous Generation ──────────────────────────────── */
503
509
  /** Generate images synchronously (blocks until fal.ai returns). */
504
510
  generate(options: GenerateOptions): Promise<Result<MotifResponse, MotifError>>;
@@ -924,6 +930,8 @@ declare class MotifServer {
924
930
  */
925
931
  private normalizeResponse;
926
932
  }
933
+ /** @deprecated Renamed to {@link FalClient}. `MotifServer` is kept as an alias for backwards compatibility and will be removed in 1.0. */
934
+ declare const MotifServer: typeof FalClient;
927
935
  declare class MotifError extends Error {
928
936
  readonly status: number;
929
937
  readonly code?: string;
@@ -1320,4 +1328,4 @@ type FalToolId = (typeof FAL_TOOL_IDS)[number];
1320
1328
  declare function isFalToolId(tool: string): tool is FalToolId;
1321
1329
  declare function buildFalToolRequest(options: FalToolRunOptions): FalToolRequest;
1322
1330
 
1323
- export { ASPECT_RATIOS, type AspectRatio, type BackgroundMode, CREATIVE_FIELDS, CREATIVE_TAXONOMY, type CreativeDirection, type CreativeField, type CreativeOption, CreativeOptionError, type CreativeOptionErrorDetails, type CreativePromptResult, type CustomImageSize, EDIT_CAPABLE_MODELS, type EnrichPromptOptions, FAL_TOOLS, FAL_TOOLS_CHECKED_AT, FAL_TOOL_IDS, FORMAT_PRESETS, type FalImageSizePreset, type FalToolConfig, type FalToolId, type FalToolInputKind, type FalToolRequest, type FalToolRunOptions, GENERATION_MODELS, type GenerateOptions, type GenerationModelName, type GptImageSize, IDEOGRAM_STYLES, IMAGE_EDITING_TOP_20, IMAGE_TEXT_TO_IMAGE_TOP_20, type ImageOutputFormat, type ImageQuality, type ImageSize, type JobStatus, type LeaderboardEntry, type LeaderboardSnapshot, MODELS, type ModelConfig, type ModelType, type MotifEnv, MotifError, type MotifImage, type MotifResponse, MotifServer, type MotifServerConfig, type QueuedJob, RECRAFT_STYLES, RESOLUTIONS, type RemoveBackgroundOptions, type Resolution, type SizeMode, type ThinkingLevel, type ToolResponse, type ToolRunOptions, UTILITY_MODELS, type UpscaleOptions, VIDEO_IMAGE_TO_VIDEO_TOP_15, VIDEO_MODELS, VIDEO_TEXT_TO_VIDEO_TOP_15, type VideoOptions, type VideoResponse, aspectToFalImageSize, aspectToGptSize, buildFalToolRequest, buildGenerateBody, enrichPrompt, estimateCost, estimateVideoCost, getFalKeyFromEnv, isFalToolId, motifEnvSchema, parseMotifEnv, sanitizePrompt };
1331
+ export { ASPECT_RATIOS, type AspectRatio, type BackgroundMode, CREATIVE_FIELDS, CREATIVE_TAXONOMY, type CreativeDirection, type CreativeField, type CreativeOption, CreativeOptionError, type CreativeOptionErrorDetails, type CreativePromptResult, type CustomImageSize, EDIT_CAPABLE_MODELS, type EnrichPromptOptions, FAL_TOOLS, FAL_TOOLS_CHECKED_AT, FAL_TOOL_IDS, FORMAT_PRESETS, FalClient, type FalClientConfig, type FalImageSizePreset, type FalToolConfig, type FalToolId, type FalToolInputKind, type FalToolRequest, type FalToolRunOptions, GENERATION_MODELS, type GenerateOptions, type GenerationModelName, type GptImageSize, IDEOGRAM_STYLES, IMAGE_EDITING_TOP_20, IMAGE_TEXT_TO_IMAGE_TOP_20, type ImageOutputFormat, type ImageQuality, type ImageSize, type JobStatus, type LeaderboardEntry, type LeaderboardSnapshot, MODELS, type ModelConfig, type ModelType, type MotifEnv, MotifError, type MotifImage, type MotifResponse, MotifServer, type MotifServerConfig, type QueuedJob, RECRAFT_STYLES, RESOLUTIONS, type RemoveBackgroundOptions, type Resolution, type SizeMode, type ThinkingLevel, type ToolResponse, type ToolRunOptions, UTILITY_MODELS, type UpscaleOptions, VIDEO_IMAGE_TO_VIDEO_TOP_15, VIDEO_MODELS, VIDEO_TEXT_TO_VIDEO_TOP_15, type VideoOptions, type VideoResponse, aspectToFalImageSize, aspectToGptSize, buildFalToolRequest, buildGenerateBody, enrichPrompt, estimateCost, estimateVideoCost, getFalKeyFromEnv, isFalToolId, motifEnvSchema, parseMotifEnv, sanitizePrompt };
package/dist/index.js CHANGED
@@ -2655,7 +2655,7 @@ var FAL_BASE_URL = "https://fal.run";
2655
2655
  var FAL_QUEUE_URL = "https://queue.fal.run";
2656
2656
  var FAL_API_URL = "https://api.fal.ai";
2657
2657
  var FAL_REST_URL = "https://rest.alpha.fal.ai";
2658
- var MotifServer = class {
2658
+ var FalClient = class {
2659
2659
  apiKey;
2660
2660
  timeout;
2661
2661
  retries;
@@ -3177,6 +3177,7 @@ var MotifServer = class {
3177
3177
  });
3178
3178
  }
3179
3179
  };
3180
+ var MotifServer = FalClient;
3180
3181
  var MotifError = class extends Error {
3181
3182
  status;
3182
3183
  code;
@@ -3209,6 +3210,7 @@ export {
3209
3210
  FAL_TOOLS_CHECKED_AT,
3210
3211
  FAL_TOOL_IDS,
3211
3212
  FORMAT_PRESETS,
3213
+ FalClient,
3212
3214
  GENERATION_MODELS,
3213
3215
  IDEOGRAM_STYLES,
3214
3216
  IMAGE_EDITING_TOP_20,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@howells/motif-sdk",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "description": "Public Node SDK for Motif fal.ai generation, editing, utility tools, and model metadata.",
5
5
  "keywords": [
6
6
  "fal",