magic-hour 0.59.0 → 0.61.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.
Files changed (43) hide show
  1. package/README.md +5 -0
  2. package/dist/environment.d.ts +1 -1
  3. package/dist/environment.js +1 -1
  4. package/dist/resources/v1/ai-image-editor/request-types.d.ts +29 -19
  5. package/dist/resources/v1/ai-image-editor/request-types.js +2 -2
  6. package/dist/resources/v1/ai-image-generator/request-types.d.ts +35 -22
  7. package/dist/resources/v1/ai-image-generator/request-types.js +4 -2
  8. package/dist/resources/v1/body-swap/index.d.ts +2 -0
  9. package/dist/resources/v1/body-swap/index.js +5 -0
  10. package/dist/resources/v1/body-swap/request-types.d.ts +33 -0
  11. package/dist/resources/v1/body-swap/request-types.js +76 -0
  12. package/dist/resources/v1/body-swap/resource-client.d.ts +64 -0
  13. package/dist/resources/v1/body-swap/resource-client.js +105 -0
  14. package/dist/resources/v1/image-to-video/request-types.d.ts +4 -4
  15. package/dist/resources/v1/index.d.ts +1 -0
  16. package/dist/resources/v1/index.js +2 -1
  17. package/dist/resources/v1/resource-client.d.ts +3 -0
  18. package/dist/resources/v1/resource-client.js +5 -0
  19. package/dist/resources/v1/text-to-video/request-types.d.ts +4 -4
  20. package/dist/types/index.d.ts +4 -0
  21. package/dist/types/v1-ai-image-editor-create-body-model-enum.d.ts +12 -12
  22. package/dist/types/v1-ai-image-editor-create-body-resolution-enum.d.ts +16 -6
  23. package/dist/types/v1-ai-image-editor-create-body.d.ts +29 -19
  24. package/dist/types/v1-ai-image-editor-create-body.js +2 -2
  25. package/dist/types/v1-ai-image-generator-create-body-model-enum.d.ts +17 -14
  26. package/dist/types/v1-ai-image-generator-create-body-resolution-enum.d.ts +16 -6
  27. package/dist/types/v1-ai-image-generator-create-body-style-quality-mode-enum.d.ts +1 -1
  28. package/dist/types/v1-ai-image-generator-create-body-style.d.ts +1 -1
  29. package/dist/types/v1-ai-image-generator-create-body.d.ts +35 -22
  30. package/dist/types/v1-ai-image-generator-create-body.js +4 -2
  31. package/dist/types/v1-body-swap-create-body-assets.d.ts +37 -0
  32. package/dist/types/v1-body-swap-create-body-assets.js +71 -0
  33. package/dist/types/v1-body-swap-create-body-resolution-enum.d.ts +4 -0
  34. package/dist/types/v1-body-swap-create-body-resolution-enum.js +2 -0
  35. package/dist/types/v1-body-swap-create-body.d.ts +33 -0
  36. package/dist/types/v1-body-swap-create-body.js +76 -0
  37. package/dist/types/v1-body-swap-create-response.d.ts +34 -0
  38. package/dist/types/v1-body-swap-create-response.js +75 -0
  39. package/dist/types/v1-image-projects-get-response.d.ts +1 -1
  40. package/dist/types/v1-image-to-video-create-body.d.ts +4 -4
  41. package/dist/types/v1-text-to-video-create-body.d.ts +4 -4
  42. package/dist/types/v1-video-projects-get-response.d.ts +1 -1
  43. package/package.json +1 -1
package/README.md CHANGED
@@ -277,6 +277,11 @@ Valid values are: `none`, `error`, `warn`, `info`, `debug` (case insensitive). I
277
277
  - [create](src/resources/v1/auto-subtitle-generator/README.md#create) - Auto Subtitle Generator
278
278
  - [generate](src/resources/v1/auto-subtitle-generator/README.md#generate) - Auto Subtitle Generator Generate Workflow
279
279
 
280
+ ### [v1.bodySwap](src/resources/v1/body-swap/README.md)
281
+
282
+ - [create](src/resources/v1/body-swap/README.md#create) - Body Swap
283
+ - [generate](src/resources/v1/body-swap/README.md#generate) - Body Swap Generate Workflow
284
+
280
285
  ### [v1.faceDetection](src/resources/v1/face-detection/README.md)
281
286
 
282
287
  - [create](src/resources/v1/face-detection/README.md#create) - Face Detection
@@ -1,4 +1,4 @@
1
1
  export declare enum Environment {
2
2
  Environment = "https://api.magichour.ai",
3
- MockServer = "https://api.sideko.dev/v1/mock/magichour/magic-hour/0.60.0"
3
+ MockServer = "https://api.sideko.dev/v1/mock/magichour/magic-hour/0.62.0"
4
4
  }
@@ -4,5 +4,5 @@ exports.Environment = void 0;
4
4
  var Environment;
5
5
  (function (Environment) {
6
6
  Environment["Environment"] = "https://api.magichour.ai";
7
- Environment["MockServer"] = "https://api.sideko.dev/v1/mock/magichour/magic-hour/0.60.0";
7
+ Environment["MockServer"] = "https://api.sideko.dev/v1/mock/magichour/magic-hour/0.62.0";
8
8
  })(Environment || (exports.Environment = Environment = {}));
@@ -22,29 +22,29 @@ export type CreateRequest = {
22
22
  *
23
23
  * **Models:**
24
24
  * - `default` - Use the model we recommend, which will change over time. This is recommended unless you need a specific model. This is the default behavior.
25
- * - `qwen-edit` - 10 credits/image
25
+ * - `qwen-edit` - from 10 credits/image
26
+ * - Supported resolutions: 640px, 1k, 2k
26
27
  * - Available for tiers: free, creator, pro, business
27
- * - Image count allowed: 1
28
28
  * - Max additional input images: 2
29
- * - `nano-banana` - 50 credits/image
29
+ * - `nano-banana` - from 50 credits/image
30
+ * - Supported resolutions: 640px, 1k
30
31
  * - Available for tiers: free, creator, pro, business
31
- * - Image count allowed: 1
32
32
  * - Max additional input images: 9
33
- * - `nano-banana-2` - 100 credits/image
33
+ * - `nano-banana-2` - from 100 credits/image
34
+ * - Supported resolutions: 640px, 1k, 2k, 4k
34
35
  * - Available for tiers: free, creator, pro, business
35
- * - Image count allowed: 1
36
36
  * - Max additional input images: 9
37
- * - `seedream-v4` - 50 credits/image
37
+ * - `seedream-v4` - from 40 credits/image
38
+ * - Supported resolutions: 640px, 1k, 2k, 4k
38
39
  * - Available for tiers: free, creator, pro, business
39
- * - Image count allowed: 1
40
40
  * - Max additional input images: 9
41
- * - `nano-banana-pro` - 150 credits/image
41
+ * - `nano-banana-pro` - from 150 credits/image
42
+ * - Supported resolutions: 1k, 2k, 4k
42
43
  * - Available for tiers: creator, pro, business
43
- * - Image count allowed: 1, 4, 9, 16
44
44
  * - Max additional input images: 9
45
- * - `seedream-v4.5` - 100 credits/image
45
+ * - `seedream-v4.5` - from 50 credits/image
46
+ * - Supported resolutions: 640px, 1k, 2k, 4k
46
47
  * - Available for tiers: creator, pro, business
47
- * - Image count allowed: 1
48
48
  * - Max additional input images: 9
49
49
  *
50
50
  */
@@ -54,16 +54,26 @@ export type CreateRequest = {
54
54
  */
55
55
  name?: string | undefined;
56
56
  /**
57
- * Maximum resolution for the generated image.
57
+ * Maximum resolution (longest edge) for the output image.
58
58
  *
59
59
  * **Options:**
60
- * - `auto` - Automatic resolution (all tiers, default)
61
- * - `2k` - Up to 2048px (requires Pro or Business tier)
62
- * - `4k` - Up to 4096px (requires Business tier)
60
+ * - `640px` — up to 640px
61
+ * - `1k` — up to 1024px
62
+ * - `2k` — up to 2048px
63
+ * - `4k` — up to 4096px
64
+ * - `auto` — **Deprecated.** Mapped server-side from your subscription tier to the best matching resolution the model supports
63
65
  *
64
- * Note: Resolution availability depends on your subscription tier. Defaults to `auto` if not specified.
66
+ * **Per-model support:**
67
+ * - `qwen-edit` - 640px, 1k, 2k
68
+ * - `nano-banana` - 640px, 1k
69
+ * - `nano-banana-2` - 640px, 1k, 2k, 4k
70
+ * - `seedream-v4` - 640px, 1k, 2k, 4k
71
+ * - `nano-banana-pro` - 1k, 2k, 4k
72
+ * - `seedream-v4.5` - 640px, 1k, 2k, 4k
73
+ *
74
+ * Note: Resolution availability depends on the model and your subscription tier.
65
75
  */
66
- resolution?: ("2k" | "4k" | "auto") | undefined;
76
+ resolution?: ("1k" | "2k" | "4k" | "640px" | "auto") | undefined;
67
77
  style: V1AiImageEditorCreateBodyStyle;
68
78
  };
69
79
  /**
@@ -77,7 +87,7 @@ export type External$CreateRequest = {
77
87
  image_count?: number | undefined;
78
88
  model?: ("default" | "nano-banana" | "nano-banana-2" | "nano-banana-pro" | "qwen-edit" | "seedream-v4" | "seedream-v4.5") | undefined;
79
89
  name?: string | undefined;
80
- resolution?: ("2k" | "4k" | "auto") | undefined;
90
+ resolution?: ("1k" | "2k" | "4k" | "640px" | "auto") | undefined;
81
91
  style: External$V1AiImageEditorCreateBodyStyle;
82
92
  };
83
93
  export declare const Schemas$CreateRequest: {
@@ -60,7 +60,7 @@ const SchemaIn$CreateRequest = z
60
60
  ])
61
61
  .optional(),
62
62
  name: z.string().optional(),
63
- resolution: z.enum(["2k", "4k", "auto"]).optional(),
63
+ resolution: z.enum(["1k", "2k", "4k", "640px", "auto"]).optional(),
64
64
  style: v1_ai_image_editor_create_body_style_1.Schemas$V1AiImageEditorCreateBodyStyle.in,
65
65
  })
66
66
  .transform((obj) => {
@@ -97,7 +97,7 @@ const SchemaOut$CreateRequest = z
97
97
  ])
98
98
  .optional(),
99
99
  name: z.string().optional(),
100
- resolution: z.enum(["2k", "4k", "auto"]).optional(),
100
+ resolution: z.enum(["1k", "2k", "4k", "640px", "auto"]).optional(),
101
101
  style: v1_ai_image_editor_create_body_style_1.Schemas$V1AiImageEditorCreateBodyStyle.out,
102
102
  })
103
103
  .transform((obj) => {
@@ -17,33 +17,36 @@ export type CreateRequest = {
17
17
  *
18
18
  * **Models:**
19
19
  * - `default` - Use the model we recommend, which will change over time. This is recommended unless you need a specific model. This is the default behavior.
20
- * - `flux-schnell` - 5 credits/image
21
- * - Supported resolutions: auto
20
+ * - `flux-schnell` - from 5 credits/image
21
+ * - Supported resolutions: 640px, 1k, 2k
22
22
  * - Available for tiers: free, creator, pro, business
23
23
  * - Image count allowed: 1, 2, 3, 4
24
- * - `z-image-turbo` - 5 credits/image
25
- * - Supported resolutions: auto, 2k
24
+ * - `z-image-turbo` - from 5 credits/image
25
+ * - Supported resolutions: 640px, 1k, 2k
26
26
  * - Available for tiers: free, creator, pro, business
27
27
  * - Image count allowed: 1, 2, 3, 4
28
- * - `seedream` - 30 credits/image
29
- * - Supported resolutions: auto, 2k, 4k
28
+ * - `seedream-v4` - from 40 credits/image
29
+ * - Supported resolutions: 640px, 1k, 2k, 4k
30
30
  * - Available for tiers: free, creator, pro, business
31
31
  * - Image count allowed: 1, 2, 3, 4
32
- * - `nano-banana` - 50 credits/image
33
- * - Supported resolutions: auto
32
+ * - `nano-banana` - from 50 credits/image
33
+ * - Supported resolutions: 640px, 1k
34
34
  * - Available for tiers: free, creator, pro, business
35
35
  * - Image count allowed: 1, 2, 3, 4
36
- * - `nano-banana-2` - 100 credits/image
37
- * - Supported resolutions: auto, 2k, 4k
36
+ * - `nano-banana-2` - from 100 credits/image
37
+ * - Supported resolutions: 640px, 1k, 2k, 4k
38
38
  * - Available for tiers: free, creator, pro, business
39
- * - Image count allowed: 1, 2, 3, 4
40
- * - `nano-banana-pro` - 150 credits/image
41
- * - Supported resolutions: auto, 2k, 4k
39
+ * - Image count allowed: 1, 4, 9, 16
40
+ * - `nano-banana-pro` - from 150 credits/image
41
+ * - Supported resolutions: 1k, 2k, 4k
42
42
  * - Available for tiers: creator, pro, business
43
43
  * - Image count allowed: 1, 4, 9, 16
44
44
  *
45
+ * **Deprecated Enum Values:**
46
+ * - `seedream` - Use `seedream-v4` instead.
47
+ *
45
48
  */
46
- model?: ("default" | "flux-schnell" | "nano-banana" | "nano-banana-2" | "nano-banana-pro" | "seedream" | "z-image-turbo") | undefined;
49
+ model?: ("default" | "flux-schnell" | "nano-banana" | "nano-banana-2" | "nano-banana-pro" | "seedream" | "seedream-v4" | "z-image-turbo") | undefined;
47
50
  /**
48
51
  * Give your image a custom name for easy identification.
49
52
  */
@@ -55,16 +58,26 @@ export type CreateRequest = {
55
58
  */
56
59
  orientation?: ("landscape" | "portrait" | "square") | undefined;
57
60
  /**
58
- * Maximum resolution for the generated image.
61
+ * Maximum resolution (longest edge) for the output image.
59
62
  *
60
63
  * **Options:**
61
- * - `auto` - Automatic resolution (all tiers, default)
62
- * - `2k` - Up to 2048px (requires Pro or Business tier)
63
- * - `4k` - Up to 4096px (requires Business tier)
64
+ * - `640px` — up to 640px
65
+ * - `1k` — up to 1024px
66
+ * - `2k` — up to 2048px
67
+ * - `4k` — up to 4096px
68
+ * - `auto` — **Deprecated.** Mapped server-side from your subscription tier to the best matching resolution the model supports
69
+ *
70
+ * **Per-model support:**
71
+ * - `flux-schnell` - 640px, 1k, 2k
72
+ * - `z-image-turbo` - 640px, 1k, 2k
73
+ * - `seedream-v4` - 640px, 1k, 2k, 4k
74
+ * - `nano-banana` - 640px, 1k
75
+ * - `nano-banana-2` - 640px, 1k, 2k, 4k
76
+ * - `nano-banana-pro` - 1k, 2k, 4k
64
77
  *
65
- * Note: Resolution availability depends on the model and your subscription tier. See `model` field for which resolutions each model supports. Defaults to `auto` if not specified.
78
+ * Note: Resolution availability depends on the model and your subscription tier.
66
79
  */
67
- resolution?: ("2k" | "4k" | "auto") | undefined;
80
+ resolution?: ("1k" | "2k" | "4k" | "640px" | "auto") | undefined;
68
81
  /**
69
82
  * The art style to use for image generation.
70
83
  */
@@ -78,10 +91,10 @@ export type CreateRequest = {
78
91
  export type External$CreateRequest = {
79
92
  aspect_ratio?: ("16:9" | "1:1" | "9:16") | undefined;
80
93
  image_count: number;
81
- model?: ("default" | "flux-schnell" | "nano-banana" | "nano-banana-2" | "nano-banana-pro" | "seedream" | "z-image-turbo") | undefined;
94
+ model?: ("default" | "flux-schnell" | "nano-banana" | "nano-banana-2" | "nano-banana-pro" | "seedream" | "seedream-v4" | "z-image-turbo") | undefined;
82
95
  name?: string | undefined;
83
96
  orientation?: ("landscape" | "portrait" | "square") | undefined;
84
- resolution?: ("2k" | "4k" | "auto") | undefined;
97
+ resolution?: ("1k" | "2k" | "4k" | "640px" | "auto") | undefined;
85
98
  style: External$V1AiImageGeneratorCreateBodyStyle;
86
99
  };
87
100
  export declare const Schemas$CreateRequest: {
@@ -52,12 +52,13 @@ const SchemaIn$CreateRequest = z
52
52
  "nano-banana-2",
53
53
  "nano-banana-pro",
54
54
  "seedream",
55
+ "seedream-v4",
55
56
  "z-image-turbo",
56
57
  ])
57
58
  .optional(),
58
59
  name: z.string().optional(),
59
60
  orientation: z.enum(["landscape", "portrait", "square"]).optional(),
60
- resolution: z.enum(["2k", "4k", "auto"]).optional(),
61
+ resolution: z.enum(["1k", "2k", "4k", "640px", "auto"]).optional(),
61
62
  style: v1_ai_image_generator_create_body_style_1.Schemas$V1AiImageGeneratorCreateBodyStyle.in,
62
63
  })
63
64
  .transform((obj) => {
@@ -87,12 +88,13 @@ const SchemaOut$CreateRequest = z
87
88
  "nano-banana-2",
88
89
  "nano-banana-pro",
89
90
  "seedream",
91
+ "seedream-v4",
90
92
  "z-image-turbo",
91
93
  ])
92
94
  .optional(),
93
95
  name: z.string().optional(),
94
96
  orientation: z.enum(["landscape", "portrait", "square"]).optional(),
95
- resolution: z.enum(["2k", "4k", "auto"]).optional(),
97
+ resolution: z.enum(["1k", "2k", "4k", "640px", "auto"]).optional(),
96
98
  style: v1_ai_image_generator_create_body_style_1.Schemas$V1AiImageGeneratorCreateBodyStyle.out,
97
99
  })
98
100
  .transform((obj) => {
@@ -0,0 +1,2 @@
1
+ export { CreateRequest } from "./request-types";
2
+ export { BodySwapClient } from "./resource-client";
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BodySwapClient = void 0;
4
+ var resource_client_1 = require("./resource-client");
5
+ Object.defineProperty(exports, "BodySwapClient", { enumerable: true, get: function () { return resource_client_1.BodySwapClient; } });
@@ -0,0 +1,33 @@
1
+ import * as z from "zod";
2
+ import { External$V1BodySwapCreateBodyAssets, V1BodySwapCreateBodyAssets } from "../../../types/v1-body-swap-create-body-assets";
3
+ /**
4
+ * CreateRequest
5
+ */
6
+ export type CreateRequest = {
7
+ /**
8
+ * Person image and scene image for body swap
9
+ */
10
+ assets: V1BodySwapCreateBodyAssets;
11
+ /**
12
+ * Give your image a custom name for easy identification.
13
+ */
14
+ name?: string | undefined;
15
+ /**
16
+ * Output resolution. Determines credits charged for the run.
17
+ */
18
+ resolution: "1k" | "2k" | "4k" | "640px";
19
+ };
20
+ /**
21
+ * @internal
22
+ * CreateRequest without any key transformation, this is what
23
+ * we expect to come in as network data
24
+ */
25
+ export type External$CreateRequest = {
26
+ assets: External$V1BodySwapCreateBodyAssets;
27
+ name?: string | undefined;
28
+ resolution: "1k" | "2k" | "4k" | "640px";
29
+ };
30
+ export declare const Schemas$CreateRequest: {
31
+ in: z.ZodType<CreateRequest, z.ZodTypeDef, unknown>;
32
+ out: z.ZodType<External$CreateRequest, z.ZodTypeDef, CreateRequest>;
33
+ };
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.Schemas$CreateRequest = void 0;
37
+ const make_api_request_js_1 = require("make-api-request-js");
38
+ const z = __importStar(require("zod"));
39
+ const v1_body_swap_create_body_assets_1 = require("../../../types/v1-body-swap-create-body-assets");
40
+ /**
41
+ * Takes network data, validates it, and transforms keys to match typescript object CreateRequest
42
+ */
43
+ const SchemaIn$CreateRequest = z
44
+ .object({
45
+ assets: v1_body_swap_create_body_assets_1.Schemas$V1BodySwapCreateBodyAssets.in,
46
+ name: z.string().optional(),
47
+ resolution: z.enum(["1k", "2k", "4k", "640px"]),
48
+ })
49
+ .transform((obj) => {
50
+ return (0, make_api_request_js_1.zodTransform)(obj, {
51
+ assets: "assets",
52
+ name: "name",
53
+ resolution: "resolution",
54
+ });
55
+ });
56
+ /**
57
+ * @internal
58
+ * Takes typescript data, validates it, and maps keys to match the expected external object External$CreateRequest
59
+ */
60
+ const SchemaOut$CreateRequest = z
61
+ .object({
62
+ assets: v1_body_swap_create_body_assets_1.Schemas$V1BodySwapCreateBodyAssets.out,
63
+ name: z.string().optional(),
64
+ resolution: z.enum(["1k", "2k", "4k", "640px"]),
65
+ })
66
+ .transform((obj) => {
67
+ return (0, make_api_request_js_1.zodTransform)(obj, {
68
+ assets: "assets",
69
+ name: "name",
70
+ resolution: "resolution",
71
+ });
72
+ });
73
+ exports.Schemas$CreateRequest = {
74
+ in: SchemaIn$CreateRequest,
75
+ out: SchemaOut$CreateRequest,
76
+ };
@@ -0,0 +1,64 @@
1
+ import { ApiPromise, CoreClient, CoreResourceClient, RequestOptions, ResourceClientOptions } from "make-api-request-js";
2
+ import { GenerateOptions, GenerateRequestType } from "../../../helpers/generate-type";
3
+ import * as requests from "../../../resources/v1/body-swap/request-types";
4
+ import * as types from "../../../types";
5
+ type GenerateRequest = GenerateRequestType<requests.CreateRequest, {
6
+ /**
7
+ * Image of the person to place into the scene. This value is either
8
+ * - a direct URL to the image file
9
+ * - a path to a local file
10
+ *
11
+ * Note: if the path begins with `api-assets`, it will be assumed to already be uploaded to Magic Hour's storage, and will not be uploaded again.
12
+ */
13
+ personFilePath: string;
14
+ /**
15
+ * Target scene image (background). This value is either
16
+ * - a direct URL to the image file
17
+ * - a path to a local file
18
+ *
19
+ * Note: if the path begins with `api-assets`, it will be assumed to already be uploaded to Magic Hour's storage, and will not be uploaded again.
20
+ */
21
+ sceneFilePath: string;
22
+ }>;
23
+ export declare class BodySwapClient extends CoreResourceClient {
24
+ constructor(coreClient: CoreClient, opts: ResourceClientOptions);
25
+ /**
26
+ * Body Swap
27
+ *
28
+ * Swap a person into a scene image using Nano Banana 2. Credits depend on `resolution` (from 100 credits at 640px upward).
29
+ *
30
+ * This method provides a convenient way to create a request and automatically wait for completion and download outputs.
31
+ *
32
+ * @example
33
+ * ```typescript
34
+ * import { Client } from "../../../index.js";
35
+ *
36
+ * const client = new Client({ token: process.env["API_TOKEN"]!! });
37
+ * const res = await client.v1.bodySwap.generate(
38
+ * {
39
+ * assets: {
40
+ * personFilePath: "/path/to/person.png",
41
+ * sceneFilePath: "/path/to/scene.png",
42
+ * },
43
+ * name: "My Body Swap image",
44
+ * resolution: "1k",
45
+ * },
46
+ * {
47
+ * waitForCompletion: true,
48
+ * downloadOutputs: true,
49
+ * downloadDirectory: ".",
50
+ * },
51
+ * );
52
+ * ```
53
+ */
54
+ generate(request: GenerateRequest, opts?: GenerateOptions): Promise<import("../image-projects/resource-client").V1ImageProjectsGetResponseWithDownloads>;
55
+ /**
56
+ * Body Swap
57
+ *
58
+ * Swap a person into a scene image using Nano Banana 2. Credits depend on `resolution` (from 100 credits at 640px upward).
59
+ *
60
+ * POST /v1/body-swap
61
+ */
62
+ create(request: requests.CreateRequest, opts?: RequestOptions): ApiPromise<types.V1BodySwapCreateResponse>;
63
+ }
64
+ export {};
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __rest = (this && this.__rest) || function (s, e) {
12
+ var t = {};
13
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
14
+ t[p] = s[p];
15
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
16
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
17
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
18
+ t[p[i]] = s[p[i]];
19
+ }
20
+ return t;
21
+ };
22
+ Object.defineProperty(exports, "__esModule", { value: true });
23
+ exports.BodySwapClient = void 0;
24
+ const make_api_request_js_1 = require("make-api-request-js");
25
+ const logger_1 = require("../../../logger");
26
+ const files_1 = require("../../../resources/v1/files");
27
+ const image_projects_1 = require("../../../resources/v1/image-projects");
28
+ const v1_body_swap_create_body_1 = require("../../../types/v1-body-swap-create-body");
29
+ const v1_body_swap_create_response_1 = require("../../../types/v1-body-swap-create-response");
30
+ class BodySwapClient extends make_api_request_js_1.CoreResourceClient {
31
+ constructor(coreClient, opts) {
32
+ super(coreClient, opts);
33
+ }
34
+ /**
35
+ * Body Swap
36
+ *
37
+ * Swap a person into a scene image using Nano Banana 2. Credits depend on `resolution` (from 100 credits at 640px upward).
38
+ *
39
+ * This method provides a convenient way to create a request and automatically wait for completion and download outputs.
40
+ *
41
+ * @example
42
+ * ```typescript
43
+ * import { Client } from "../../../index.js";
44
+ *
45
+ * const client = new Client({ token: process.env["API_TOKEN"]!! });
46
+ * const res = await client.v1.bodySwap.generate(
47
+ * {
48
+ * assets: {
49
+ * personFilePath: "/path/to/person.png",
50
+ * sceneFilePath: "/path/to/scene.png",
51
+ * },
52
+ * name: "My Body Swap image",
53
+ * resolution: "1k",
54
+ * },
55
+ * {
56
+ * waitForCompletion: true,
57
+ * downloadOutputs: true,
58
+ * downloadDirectory: ".",
59
+ * },
60
+ * );
61
+ * ```
62
+ */
63
+ generate(request_1) {
64
+ return __awaiter(this, arguments, void 0, function* (request, opts = {}) {
65
+ const { waitForCompletion = true, downloadOutputs = true, downloadDirectory = undefined } = opts, createOpts = __rest(opts, ["waitForCompletion", "downloadOutputs", "downloadDirectory"]);
66
+ const fileClient = new files_1.FilesClient(this._client, this._opts);
67
+ const _a = request.assets, { personFilePath, sceneFilePath } = _a, restAssets = __rest(_a, ["personFilePath", "sceneFilePath"]);
68
+ (0, logger_1.getLogger)().debug(`Uploading file ${personFilePath} to Magic Hour's storage`);
69
+ (0, logger_1.getLogger)().debug(`Uploading file ${sceneFilePath} to Magic Hour's storage`);
70
+ const [uploadedPersonFilePath, uploadedSceneFilePath] = yield Promise.all([
71
+ fileClient.uploadFile(personFilePath),
72
+ fileClient.uploadFile(sceneFilePath),
73
+ ]);
74
+ (0, logger_1.getLogger)().info(`Uploaded file ${personFilePath} to Magic Hour's storage as ${uploadedPersonFilePath}`);
75
+ (0, logger_1.getLogger)().info(`Uploaded file ${sceneFilePath} to Magic Hour's storage as ${uploadedSceneFilePath}`);
76
+ const createResponse = yield this.create(Object.assign(Object.assign({}, request), { assets: Object.assign(Object.assign({}, restAssets), { personFilePath: uploadedPersonFilePath, sceneFilePath: uploadedSceneFilePath }) }), createOpts);
77
+ (0, logger_1.getLogger)().info(`Created BodySwapClient project ${createResponse.id}`);
78
+ const projectsClient = new image_projects_1.ImageProjectsClient(this._client, this._opts);
79
+ (0, logger_1.getLogger)().debug(`Checking result for BodySwapClient project ${createResponse.id}`);
80
+ const result = yield projectsClient.checkResult({ id: createResponse.id }, Object.assign({ waitForCompletion,
81
+ downloadOutputs,
82
+ downloadDirectory }, createOpts));
83
+ return result;
84
+ });
85
+ }
86
+ /**
87
+ * Body Swap
88
+ *
89
+ * Swap a person into a scene image using Nano Banana 2. Credits depend on `resolution` (from 100 credits at 640px upward).
90
+ *
91
+ * POST /v1/body-swap
92
+ */
93
+ create(request, opts) {
94
+ return this._client.makeRequest({
95
+ method: "post",
96
+ path: "/v1/body-swap",
97
+ auth: ["bearerAuth"],
98
+ contentType: "application/json",
99
+ body: v1_body_swap_create_body_1.Schemas$V1BodySwapCreateBody.out.parse(request),
100
+ responseSchema: v1_body_swap_create_response_1.Schemas$V1BodySwapCreateResponse.in,
101
+ opts,
102
+ });
103
+ }
104
+ }
105
+ exports.BodySwapClient = BodySwapClient;
@@ -16,12 +16,12 @@ export type CreateRequest = {
16
16
  * * **`ltx-2`**: Automatically included with no extra credits
17
17
  * * **`wan-2.2`**: Not supported
18
18
  * * **`seedance`**: Not supported
19
- * * **`seedance-2.0`**: Not supported
19
+ * * **`seedance-2.0`**: Automatically included with no extra credits
20
20
  * * **`kling-2.5`**: Automatically included with no extra credits
21
21
  * * **`kling-3.0`**: Toggle-able (can enable/disable)
22
22
  * * **`sora-2`**: Automatically included with no extra credits
23
23
  * * **`veo3.1`**: Toggle-able (can enable/disable)
24
- * * **`veo3.1-lite`**: Automatically included with no extra credits
24
+ * * **`veo3.1-lite`**: Toggle-able (can enable/disable)
25
25
  *
26
26
  * Legacy models:
27
27
  * * **`kling-1.6`**: Not supported
@@ -30,7 +30,7 @@ export type CreateRequest = {
30
30
  /**
31
31
  * The total duration of the output video in seconds. Supported durations depend on the chosen model:
32
32
  *
33
- * * **`ltx-2`**: 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30
33
+ * * **`ltx-2`**: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30
34
34
  * * **`wan-2.2`**: 3, 4, 5, 6, 7, 8, 9, 10, 15
35
35
  * * **`seedance`**: 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12
36
36
  * * **`seedance-2.0`**: 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
@@ -38,7 +38,7 @@ export type CreateRequest = {
38
38
  * * **`kling-3.0`**: 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
39
39
  * * **`sora-2`**: 4, 8, 12, 24, 36, 48, 60
40
40
  * * **`veo3.1`**: 4, 6, 8, 16, 24, 32, 40, 48, 56
41
- * * **`veo3.1-lite`**: 4, 6, 8, 16, 24, 32, 40, 48, 56
41
+ * * **`veo3.1-lite`**: 8, 16, 24, 32, 40, 48, 56
42
42
  *
43
43
  * Legacy models:
44
44
  * * **`kling-1.6`**: 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60
@@ -13,6 +13,7 @@ export * as aiVoiceGenerator from "./ai-voice-generator";
13
13
  export * as animation from "./animation";
14
14
  export * as audioProjects from "./audio-projects";
15
15
  export * as autoSubtitleGenerator from "./auto-subtitle-generator";
16
+ export * as bodySwap from "./body-swap";
16
17
  export * as faceDetection from "./face-detection";
17
18
  export * as faceSwap from "./face-swap";
18
19
  export * as faceSwapPhoto from "./face-swap-photo";
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.videoToVideo = exports.videoProjects = exports.textToVideo = exports.V1Client = exports.photoColorizer = exports.lipSync = exports.imageToVideo = exports.imageProjects = exports.imageBackgroundRemover = exports.headSwap = exports.files = exports.faceSwapPhoto = exports.faceSwap = exports.faceDetection = exports.autoSubtitleGenerator = exports.audioProjects = exports.animation = exports.aiVoiceGenerator = exports.aiVoiceCloner = exports.aiTalkingPhoto = exports.aiQrCodeGenerator = exports.aiMemeGenerator = exports.aiImageUpscaler = exports.aiImageGenerator = exports.aiImageEditor = exports.aiHeadshotGenerator = exports.aiGifGenerator = exports.aiFaceEditor = exports.aiClothesChanger = void 0;
36
+ exports.videoToVideo = exports.videoProjects = exports.textToVideo = exports.V1Client = exports.photoColorizer = exports.lipSync = exports.imageToVideo = exports.imageProjects = exports.imageBackgroundRemover = exports.headSwap = exports.files = exports.faceSwapPhoto = exports.faceSwap = exports.faceDetection = exports.bodySwap = exports.autoSubtitleGenerator = exports.audioProjects = exports.animation = exports.aiVoiceGenerator = exports.aiVoiceCloner = exports.aiTalkingPhoto = exports.aiQrCodeGenerator = exports.aiMemeGenerator = exports.aiImageUpscaler = exports.aiImageGenerator = exports.aiImageEditor = exports.aiHeadshotGenerator = exports.aiGifGenerator = exports.aiFaceEditor = exports.aiClothesChanger = void 0;
37
37
  exports.aiClothesChanger = __importStar(require("./ai-clothes-changer"));
38
38
  exports.aiFaceEditor = __importStar(require("./ai-face-editor"));
39
39
  exports.aiGifGenerator = __importStar(require("./ai-gif-generator"));
@@ -49,6 +49,7 @@ exports.aiVoiceGenerator = __importStar(require("./ai-voice-generator"));
49
49
  exports.animation = __importStar(require("./animation"));
50
50
  exports.audioProjects = __importStar(require("./audio-projects"));
51
51
  exports.autoSubtitleGenerator = __importStar(require("./auto-subtitle-generator"));
52
+ exports.bodySwap = __importStar(require("./body-swap"));
52
53
  exports.faceDetection = __importStar(require("./face-detection"));
53
54
  exports.faceSwap = __importStar(require("./face-swap"));
54
55
  exports.faceSwapPhoto = __importStar(require("./face-swap-photo"));
@@ -14,6 +14,7 @@ import { AiVoiceGeneratorClient } from "../../resources/v1/ai-voice-generator";
14
14
  import { AnimationClient } from "../../resources/v1/animation";
15
15
  import { AudioProjectsClient } from "../../resources/v1/audio-projects";
16
16
  import { AutoSubtitleGeneratorClient } from "../../resources/v1/auto-subtitle-generator";
17
+ import { BodySwapClient } from "../../resources/v1/body-swap";
17
18
  import { FaceDetectionClient } from "../../resources/v1/face-detection";
18
19
  import { FaceSwapClient } from "../../resources/v1/face-swap";
19
20
  import { FaceSwapPhotoClient } from "../../resources/v1/face-swap-photo";
@@ -28,6 +29,7 @@ import { TextToVideoClient } from "../../resources/v1/text-to-video";
28
29
  import { VideoProjectsClient } from "../../resources/v1/video-projects";
29
30
  import { VideoToVideoClient } from "../../resources/v1/video-to-video";
30
31
  export declare class V1Client extends CoreResourceClient {
32
+ private _bodySwapLazy?;
31
33
  private _headSwapLazy?;
32
34
  private _aiVoiceClonerLazy?;
33
35
  private _audioProjectsLazy?;
@@ -85,4 +87,5 @@ export declare class V1Client extends CoreResourceClient {
85
87
  get audioProjects(): AudioProjectsClient;
86
88
  get aiVoiceCloner(): AiVoiceClonerClient;
87
89
  get headSwap(): HeadSwapClient;
90
+ get bodySwap(): BodySwapClient;
88
91
  }
@@ -21,6 +21,7 @@ class V1Client extends make_api_request_js_1.CoreResourceClient {
21
21
  this.animation;
22
22
  this.audioProjects;
23
23
  this.autoSubtitleGenerator;
24
+ this.bodySwap;
24
25
  this.faceDetection;
25
26
  this.faceSwap;
26
27
  this.faceSwapPhoto;
@@ -171,5 +172,9 @@ class V1Client extends make_api_request_js_1.CoreResourceClient {
171
172
  var _a;
172
173
  return ((_a = this._headSwapLazy) !== null && _a !== void 0 ? _a : (this._headSwapLazy = new (require("./head-swap").HeadSwapClient)(this._client, this._opts)));
173
174
  }
175
+ get bodySwap() {
176
+ var _a;
177
+ return ((_a = this._bodySwapLazy) !== null && _a !== void 0 ? _a : (this._bodySwapLazy = new (require("./body-swap").BodySwapClient)(this._client, this._opts)));
178
+ }
174
179
  }
175
180
  exports.V1Client = V1Client;