magic-hour 0.60.0 → 0.62.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 (53) 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 +7 -2
  5. package/dist/resources/v1/ai-image-editor/request-types.js +2 -0
  6. package/dist/resources/v1/ai-image-generator/request-types.d.ts +8 -3
  7. package/dist/resources/v1/ai-image-generator/request-types.js +2 -0
  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/files/upload-urls/resource-client.d.ts +1 -1
  15. package/dist/resources/v1/files/upload-urls/resource-client.js +1 -1
  16. package/dist/resources/v1/image-to-video/request-types.d.ts +27 -36
  17. package/dist/resources/v1/image-to-video/request-types.js +4 -2
  18. package/dist/resources/v1/index.d.ts +1 -0
  19. package/dist/resources/v1/index.js +2 -1
  20. package/dist/resources/v1/resource-client.d.ts +3 -0
  21. package/dist/resources/v1/resource-client.js +5 -0
  22. package/dist/resources/v1/text-to-video/request-types.d.ts +32 -43
  23. package/dist/resources/v1/text-to-video/request-types.js +4 -2
  24. package/dist/types/index.d.ts +4 -0
  25. package/dist/types/v1-ai-image-editor-create-body-model-enum.d.ts +5 -1
  26. package/dist/types/v1-ai-image-editor-create-body-resolution-enum.d.ts +1 -0
  27. package/dist/types/v1-ai-image-editor-create-body.d.ts +7 -2
  28. package/dist/types/v1-ai-image-editor-create-body.js +2 -0
  29. package/dist/types/v1-ai-image-generator-create-body-model-enum.d.ts +6 -2
  30. package/dist/types/v1-ai-image-generator-create-body-resolution-enum.d.ts +1 -0
  31. package/dist/types/v1-ai-image-generator-create-body.d.ts +8 -3
  32. package/dist/types/v1-ai-image-generator-create-body.js +2 -0
  33. package/dist/types/v1-body-swap-create-body-assets.d.ts +37 -0
  34. package/dist/types/v1-body-swap-create-body-assets.js +71 -0
  35. package/dist/types/v1-body-swap-create-body-resolution-enum.d.ts +4 -0
  36. package/dist/types/v1-body-swap-create-body-resolution-enum.js +2 -0
  37. package/dist/types/v1-body-swap-create-body.d.ts +33 -0
  38. package/dist/types/v1-body-swap-create-body.js +76 -0
  39. package/dist/types/v1-body-swap-create-response.d.ts +34 -0
  40. package/dist/types/v1-body-swap-create-response.js +75 -0
  41. package/dist/types/v1-files-upload-urls-create-body-items-item.d.ts +1 -1
  42. package/dist/types/v1-image-to-video-create-body-assets.d.ts +5 -7
  43. package/dist/types/v1-image-to-video-create-body-model-enum.d.ts +7 -10
  44. package/dist/types/v1-image-to-video-create-body-resolution-enum.d.ts +6 -8
  45. package/dist/types/v1-image-to-video-create-body.d.ts +27 -36
  46. package/dist/types/v1-image-to-video-create-body.js +4 -2
  47. package/dist/types/v1-text-to-video-create-body-aspect-ratio-enum.d.ts +5 -7
  48. package/dist/types/v1-text-to-video-create-body-model-enum.d.ts +7 -10
  49. package/dist/types/v1-text-to-video-create-body-resolution-enum.d.ts +6 -8
  50. package/dist/types/v1-text-to-video-create-body.d.ts +32 -43
  51. package/dist/types/v1-text-to-video-create-body.js +4 -2
  52. package/dist/types/v1-video-projects-get-response.d.ts +1 -1
  53. 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.61.1"
3
+ MockServer = "https://api.sideko.dev/v1/mock/magichour/magic-hour/0.63.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.61.1";
7
+ Environment["MockServer"] = "https://api.sideko.dev/v1/mock/magichour/magic-hour/0.63.0";
8
8
  })(Environment || (exports.Environment = Environment = {}));
@@ -46,9 +46,13 @@ export type CreateRequest = {
46
46
  * - Supported resolutions: 640px, 1k, 2k, 4k
47
47
  * - Available for tiers: creator, pro, business
48
48
  * - Max additional input images: 9
49
+ * - `gpt-image-2` - from 50 credits/image
50
+ * - Supported resolutions: 640px, 1k, 2k, 4k
51
+ * - Available for tiers: creator, pro, business
52
+ * - Max additional input images: 9
49
53
  *
50
54
  */
51
- model?: ("default" | "nano-banana" | "nano-banana-2" | "nano-banana-pro" | "qwen-edit" | "seedream-v4" | "seedream-v4.5") | undefined;
55
+ model?: ("default" | "gpt-image-2" | "nano-banana" | "nano-banana-2" | "nano-banana-pro" | "qwen-edit" | "seedream-v4" | "seedream-v4.5") | undefined;
52
56
  /**
53
57
  * Give your image a custom name for easy identification.
54
58
  */
@@ -70,6 +74,7 @@ export type CreateRequest = {
70
74
  * - `seedream-v4` - 640px, 1k, 2k, 4k
71
75
  * - `nano-banana-pro` - 1k, 2k, 4k
72
76
  * - `seedream-v4.5` - 640px, 1k, 2k, 4k
77
+ * - `gpt-image-2` - 640px, 1k, 2k, 4k
73
78
  *
74
79
  * Note: Resolution availability depends on the model and your subscription tier.
75
80
  */
@@ -85,7 +90,7 @@ export type External$CreateRequest = {
85
90
  aspect_ratio?: ("16:9" | "1:1" | "2:3" | "3:2" | "4:3" | "4:5" | "9:16" | "auto") | undefined;
86
91
  assets: External$V1AiImageEditorCreateBodyAssets;
87
92
  image_count?: number | undefined;
88
- model?: ("default" | "nano-banana" | "nano-banana-2" | "nano-banana-pro" | "qwen-edit" | "seedream-v4" | "seedream-v4.5") | undefined;
93
+ model?: ("default" | "gpt-image-2" | "nano-banana" | "nano-banana-2" | "nano-banana-pro" | "qwen-edit" | "seedream-v4" | "seedream-v4.5") | undefined;
89
94
  name?: string | undefined;
90
95
  resolution?: ("1k" | "2k" | "4k" | "640px" | "auto") | undefined;
91
96
  style: External$V1AiImageEditorCreateBodyStyle;
@@ -51,6 +51,7 @@ const SchemaIn$CreateRequest = z
51
51
  model: z
52
52
  .enum([
53
53
  "default",
54
+ "gpt-image-2",
54
55
  "nano-banana",
55
56
  "nano-banana-2",
56
57
  "nano-banana-pro",
@@ -88,6 +89,7 @@ const SchemaOut$CreateRequest = z
88
89
  model: z
89
90
  .enum([
90
91
  "default",
92
+ "gpt-image-2",
91
93
  "nano-banana",
92
94
  "nano-banana-2",
93
95
  "nano-banana-pro",
@@ -36,17 +36,21 @@ export type CreateRequest = {
36
36
  * - `nano-banana-2` - from 100 credits/image
37
37
  * - Supported resolutions: 640px, 1k, 2k, 4k
38
38
  * - Available for tiers: free, creator, pro, business
39
- * - Image count allowed: 1, 2, 3, 4
39
+ * - Image count allowed: 1, 4, 9, 16
40
40
  * - `nano-banana-pro` - from 150 credits/image
41
41
  * - Supported resolutions: 1k, 2k, 4k
42
42
  * - Available for tiers: creator, pro, business
43
43
  * - Image count allowed: 1, 4, 9, 16
44
+ * - `gpt-image-2` - from 50 credits/image
45
+ * - Supported resolutions: 640px, 1k, 2k, 4k
46
+ * - Available for tiers: creator, pro, business
47
+ * - Image count allowed: 1, 2, 3, 4
44
48
  *
45
49
  * **Deprecated Enum Values:**
46
50
  * - `seedream` - Use `seedream-v4` instead.
47
51
  *
48
52
  */
49
- model?: ("default" | "flux-schnell" | "nano-banana" | "nano-banana-2" | "nano-banana-pro" | "seedream" | "seedream-v4" | "z-image-turbo") | undefined;
53
+ model?: ("default" | "flux-schnell" | "gpt-image-2" | "nano-banana" | "nano-banana-2" | "nano-banana-pro" | "seedream" | "seedream-v4" | "z-image-turbo") | undefined;
50
54
  /**
51
55
  * Give your image a custom name for easy identification.
52
56
  */
@@ -74,6 +78,7 @@ export type CreateRequest = {
74
78
  * - `nano-banana` - 640px, 1k
75
79
  * - `nano-banana-2` - 640px, 1k, 2k, 4k
76
80
  * - `nano-banana-pro` - 1k, 2k, 4k
81
+ * - `gpt-image-2` - 640px, 1k, 2k, 4k
77
82
  *
78
83
  * Note: Resolution availability depends on the model and your subscription tier.
79
84
  */
@@ -91,7 +96,7 @@ export type CreateRequest = {
91
96
  export type External$CreateRequest = {
92
97
  aspect_ratio?: ("16:9" | "1:1" | "9:16") | undefined;
93
98
  image_count: number;
94
- model?: ("default" | "flux-schnell" | "nano-banana" | "nano-banana-2" | "nano-banana-pro" | "seedream" | "seedream-v4" | "z-image-turbo") | undefined;
99
+ model?: ("default" | "flux-schnell" | "gpt-image-2" | "nano-banana" | "nano-banana-2" | "nano-banana-pro" | "seedream" | "seedream-v4" | "z-image-turbo") | undefined;
95
100
  name?: string | undefined;
96
101
  orientation?: ("landscape" | "portrait" | "square") | undefined;
97
102
  resolution?: ("1k" | "2k" | "4k" | "640px" | "auto") | undefined;
@@ -48,6 +48,7 @@ const SchemaIn$CreateRequest = z
48
48
  .enum([
49
49
  "default",
50
50
  "flux-schnell",
51
+ "gpt-image-2",
51
52
  "nano-banana",
52
53
  "nano-banana-2",
53
54
  "nano-banana-pro",
@@ -84,6 +85,7 @@ const SchemaOut$CreateRequest = z
84
85
  .enum([
85
86
  "default",
86
87
  "flux-schnell",
88
+ "gpt-image-2",
87
89
  "nano-banana",
88
90
  "nano-banana-2",
89
91
  "nano-banana-pro",
@@ -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;
@@ -13,7 +13,7 @@ export declare class UploadUrlsClient extends CoreResourceClient {
13
13
  * **Valid file extensions per asset type**:
14
14
  * - video: mp4, m4v, mov, webm
15
15
  * - audio: mp3, wav, aac, flac, webm, m4a
16
- * - image: png, jpg, jpeg, heic, webp, avif, jp2, tiff, bmp
16
+ * - image: png, jpg, jpeg, heic, heif, webp, avif, jp2, tiff, bmp
17
17
  * - gif: gif, webp, webm
18
18
  *
19
19
  * > Note: `gif` is only supported for face swap API `video_file_path` field.
@@ -18,7 +18,7 @@ class UploadUrlsClient extends make_api_request_js_1.CoreResourceClient {
18
18
  * **Valid file extensions per asset type**:
19
19
  * - video: mp4, m4v, mov, webm
20
20
  * - audio: mp3, wav, aac, flac, webm, m4a
21
- * - image: png, jpg, jpeg, heic, webp, avif, jp2, tiff, bmp
21
+ * - image: png, jpg, jpeg, heic, heif, webp, avif, jp2, tiff, bmp
22
22
  * - gif: gif, webp, webm
23
23
  *
24
24
  * > Note: `gif` is only supported for face swap API `video_file_path` field.
@@ -13,35 +13,31 @@ export type CreateRequest = {
13
13
  * Whether to include audio in the video. Defaults to `false` if not specified.
14
14
  *
15
15
  * Audio support varies by model:
16
- * * **`ltx-2`**: Automatically included with no extra credits
16
+ * * **`ltx-2.3`**: Toggle-able: no additional credits for audio
17
17
  * * **`wan-2.2`**: Not supported
18
+ * * **`kling-2.5`**: Toggle-able: no additional credits for audio
19
+ * * **`kling-3.0`**: Toggle-able: audio adds extra credits when enabled
20
+ * * **`veo3.1-lite`**: Toggle-able: audio adds extra credits when enabled
21
+ * * **`veo3.1`**: Toggle-able: audio adds extra credits when enabled
18
22
  * * **`seedance`**: Not supported
19
- * * **`seedance-2.0`**: Not supported
20
- * * **`kling-2.5`**: Automatically included with no extra credits
21
- * * **`kling-3.0`**: Toggle-able (can enable/disable)
22
- * * **`sora-2`**: Automatically included with no extra credits
23
- * * **`veo3.1`**: Toggle-able (can enable/disable)
24
- * * **`veo3.1-lite`**: Toggle-able (can enable/disable)
23
+ * * **`seedance-2.0`**: Toggle-able: no additional credits for audio
24
+ * * **`sora-2`**: Toggle-able: no additional credits for audio
25
25
  *
26
- * Legacy models:
27
- * * **`kling-1.6`**: Not supported
28
26
  */
29
27
  audio?: boolean | undefined;
30
28
  /**
31
29
  * The total duration of the output video in seconds. Supported durations depend on the chosen model:
32
30
  *
33
- * * **`ltx-2`**: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30
31
+ * * **`ltx-2.3`**: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30
34
32
  * * **`wan-2.2`**: 3, 4, 5, 6, 7, 8, 9, 10, 15
35
- * * **`seedance`**: 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12
36
- * * **`seedance-2.0`**: 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
37
33
  * * **`kling-2.5`**: 5, 10
38
34
  * * **`kling-3.0`**: 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
39
- * * **`sora-2`**: 4, 8, 12, 24, 36, 48, 60
40
- * * **`veo3.1`**: 4, 6, 8, 16, 24, 32, 40, 48, 56
41
35
  * * **`veo3.1-lite`**: 8, 16, 24, 32, 40, 48, 56
36
+ * * **`veo3.1`**: 4, 6, 8, 16, 24, 32, 40, 48, 56
37
+ * * **`seedance`**: 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12
38
+ * * **`seedance-2.0`**: 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
39
+ * * **`sora-2`**: 4, 8, 12, 24, 36, 48, 60
42
40
  *
43
- * Legacy models:
44
- * * **`kling-1.6`**: 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60
45
41
  */
46
42
  endSeconds: number;
47
43
  /**
@@ -53,23 +49,20 @@ export type CreateRequest = {
53
49
  /**
54
50
  * The AI model to use for video generation.
55
51
  *
56
- * * `default`: uses our currently recommended model for general use. For paid tiers, defaults to `kling-3.0`. For free tiers, it defaults to `ltx-2`.
57
- * * `ltx-2`: Fast iteration with audio and lip-sync
52
+ * * `default`: uses our currently recommended model for general use. For paid tiers, defaults to `kling-3.0`. For free tiers, it defaults to `ltx-2.3`.
53
+ * * `ltx-2.3`: Fast iteration with audio, lip-sync, and end frame
58
54
  * * `wan-2.2`: Fast, strong visuals with effects
59
- * * `seedance`: Fast iteration and start/end frames
60
- * * `seedance-2.0`: State-of-the-art quality and consistency
61
55
  * * `kling-2.5`: Motion, action, and camera control
62
56
  * * `kling-3.0`: Cinematic, multi-scene storytelling
63
- * * `sora-2`: Story-first concepts and creativity
57
+ * * `veo3.1-lite`: Fast, affordable, high-quality
64
58
  * * `veo3.1`: Realistic visuals and prompt adherence
65
- * * `veo3.1-lite`: Good for fast, affordable, high-quality daily generation.
66
- *
67
- * Legacy models:
68
- * * `kling-1.6`: Reliable baseline with smooth motion
59
+ * * `seedance`: Fast iteration and start/end frames
60
+ * * `seedance-2.0`: State-of-the-art quality and consistency
61
+ * * `sora-2`: Story-first concepts and creativity
69
62
  *
70
63
  * If you specify the deprecated model value that includes the `-audio` suffix, this will be the same as included `audio` as `true`.
71
64
  */
72
- model?: ("default" | "kling-1.6" | "kling-2.5" | "kling-2.5-audio" | "kling-3.0" | "ltx-2" | "seedance" | "seedance-2.0" | "sora-2" | "veo3.1" | "veo3.1-audio" | "veo3.1-lite" | "wan-2.2") | undefined;
65
+ model?: ("default" | "kling-1.6" | "kling-2.5" | "kling-2.5-audio" | "kling-3.0" | "ltx-2" | "ltx-2.3" | "seedance" | "seedance-2.0" | "sora-2" | "veo3.1" | "veo3.1-audio" | "veo3.1-lite" | "wan-2.2") | undefined;
73
66
  /**
74
67
  * Give your video a custom name for easy identification.
75
68
  */
@@ -77,20 +70,18 @@ export type CreateRequest = {
77
70
  /**
78
71
  * Controls the output video resolution. Defaults to `720p` on paid tiers and `480p` on free tiers.
79
72
  *
80
- * * **`ltx-2`**: Supports 480p, 720p, 1080p.
73
+ * * **`ltx-2.3`**: Supports 480p, 720p, 1080p.
81
74
  * * **`wan-2.2`**: Supports 480p, 720p, 1080p.
75
+ * * **`kling-2.5`**: Supports 720p, 1080p.
76
+ * * **`kling-3.0`**: Supports 720p, 1080p, 4k.
77
+ * * **`veo3.1-lite`**: Supports 720p, 1080p.
78
+ * * **`veo3.1`**: Supports 720p, 1080p.
82
79
  * * **`seedance`**: Supports 480p, 720p, 1080p.
83
80
  * * **`seedance-2.0`**: Supports 480p, 720p.
84
- * * **`kling-2.5`**: Supports 720p, 1080p.
85
- * * **`kling-3.0`**: Supports 720p, 1080p.
86
81
  * * **`sora-2`**: Supports 720p.
87
- * * **`veo3.1`**: Supports 720p, 1080p.
88
- * * **`veo3.1-lite`**: Supports 720p, 1080p.
89
82
  *
90
- * Legacy models:
91
- * * **`kling-1.6`**: Supports 720p, 1080p.
92
83
  */
93
- resolution?: ("1080p" | "480p" | "720p") | undefined;
84
+ resolution?: ("1080p" | "480p" | "4k" | "720p") | undefined;
94
85
  /**
95
86
  * Attributed used to dictate the style of the output
96
87
  */
@@ -112,9 +103,9 @@ export type External$CreateRequest = {
112
103
  audio?: boolean | undefined;
113
104
  end_seconds: number;
114
105
  height?: number | null | undefined;
115
- model?: ("default" | "kling-1.6" | "kling-2.5" | "kling-2.5-audio" | "kling-3.0" | "ltx-2" | "seedance" | "seedance-2.0" | "sora-2" | "veo3.1" | "veo3.1-audio" | "veo3.1-lite" | "wan-2.2") | undefined;
106
+ model?: ("default" | "kling-1.6" | "kling-2.5" | "kling-2.5-audio" | "kling-3.0" | "ltx-2" | "ltx-2.3" | "seedance" | "seedance-2.0" | "sora-2" | "veo3.1" | "veo3.1-audio" | "veo3.1-lite" | "wan-2.2") | undefined;
116
107
  name?: string | undefined;
117
- resolution?: ("1080p" | "480p" | "720p") | undefined;
108
+ resolution?: ("1080p" | "480p" | "4k" | "720p") | undefined;
118
109
  style?: External$V1ImageToVideoCreateBodyStyle | undefined;
119
110
  width?: number | null | undefined;
120
111
  };
@@ -55,6 +55,7 @@ const SchemaIn$CreateRequest = z
55
55
  "kling-2.5-audio",
56
56
  "kling-3.0",
57
57
  "ltx-2",
58
+ "ltx-2.3",
58
59
  "seedance",
59
60
  "seedance-2.0",
60
61
  "sora-2",
@@ -65,7 +66,7 @@ const SchemaIn$CreateRequest = z
65
66
  ])
66
67
  .optional(),
67
68
  name: z.string().optional(),
68
- resolution: z.enum(["1080p", "480p", "720p"]).optional(),
69
+ resolution: z.enum(["1080p", "480p", "4k", "720p"]).optional(),
69
70
  style: v1_image_to_video_create_body_style_1.Schemas$V1ImageToVideoCreateBodyStyle.in.optional(),
70
71
  width: z.number().int().nullable().optional(),
71
72
  })
@@ -100,6 +101,7 @@ const SchemaOut$CreateRequest = z
100
101
  "kling-2.5-audio",
101
102
  "kling-3.0",
102
103
  "ltx-2",
104
+ "ltx-2.3",
103
105
  "seedance",
104
106
  "seedance-2.0",
105
107
  "sora-2",
@@ -110,7 +112,7 @@ const SchemaOut$CreateRequest = z
110
112
  ])
111
113
  .optional(),
112
114
  name: z.string().optional(),
113
- resolution: z.enum(["1080p", "480p", "720p"]).optional(),
115
+ resolution: z.enum(["1080p", "480p", "4k", "720p"]).optional(),
114
116
  style: v1_image_to_video_create_body_style_1.Schemas$V1ImageToVideoCreateBodyStyle.out.optional(),
115
117
  width: z.number().int().nullable().optional(),
116
118
  })
@@ -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
  }