Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .sdk.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"id": "08f97eb1-af23-4f39-876f-bf2890f073a6",
"id": "08756a67-c9aa-401d-9e38-feee98a19df4",
"tracked_paths": [
{
"editable": true,
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "magic-hour",
"version": "0.66.0",
"version": "0.67.0",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
Expand Down
2 changes: 1 addition & 1 deletion src/environment.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export enum Environment {
Environment = "https://api.magichour.ai",
MockServer = "https://api.sideko.dev/v1/mock/magichour/magic-hour/0.67.0",
MockServer = "https://api.sideko.dev/v1/mock/magichour/magic-hour/0.68.0",
}
11 changes: 5 additions & 6 deletions src/resources/v1/ai-image-upscaler/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const res = await client.v1.aiImageUpscaler.generate(

### AI Image Upscaler <a name="create"></a>

Upscale your image using AI. Each 2x upscale costs 50 credits, and 4x upscale costs 200 credits.
Upscale your image using AI. Each 2x upscale costs 50 credits for balanced/creative modes, and 25 credits for preserve. 4x upscale costs 200 and 100 credits respectively.

**API Endpoint**: `POST /v1/ai-image-upscaler`

Expand All @@ -60,11 +60,11 @@ Upscale your image using AI. Each 2x upscale costs 50 credits, and 4x upscale co
| `assets` | ✓ | Provide the assets for upscaling | `{"imageFilePath": "api-assets/id/1234.png"}` |
| `└─ imageFilePath` | ✓ | The image to upscale. This value is either - a direct URL to the video file - `file_path` field from the response of the [upload urls API](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls). See the [file upload guide](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls#input-file) for details. . The maximum input image size is 4096x4096px. | `"api-assets/id/1234.png"` |
| `scaleFactor` | ✓ | How much to scale the image. Must be either 2 or 4. Note: 4x upscale is only available on Creator, Pro, or Business tier. | `2.0` |
| `style` | ✓ | Style settings for the upscale. Use `mode` to select between `"pro"` (faster, no enhancement required) and `"creative"` (defaults to `"Balanced"` enhancement). Defaults to `"creative"`. | `{"mode": "creative"}` |
| `└─ enhancement` | ✗ | | `"Balanced"` |
| `└─ mode` | ✗ | The upscaling mode. `"pro"` is faster and does not require `enhancement`. `"creative"` requires `enhancement`. Defaults to `"creative"`. | `"creative"` |
| `└─ prompt` | ✗ | A prompt to guide the final image. This value is ignored if `enhancement` is not Creative | `"string"` |
| `name` | ✗ | Give your image a custom name for easy identification. | `"My Image Upscaler image"` |
| `style` | ✗ | Style settings for the upscale. Use `mode` (`"preserve"`, `"balanced"`, or `"creative"`). Defaults to `"balanced"`. | `{"mode": "balanced"}` |
| `└─ enhancement` | ✗ | Deprecated: use `mode` instead. `"Resemblance"` maps to `"preserve"`. `"Balanced"` and `"Creative"` map to the same-named modes. | `"Balanced"` |
| `└─ mode` | ✗ | The upscaling mode. `"preserve"` uses the fast pro pipeline (1× credit multiplier). `"balanced"` and `"creative"` use the creative pipeline (2× credit multiplier). `"pro"` is deprecated and maps to `"preserve"`. Defaults to `"balanced"`. | `"balanced"` |
| `└─ prompt` | ✗ | A prompt to guide the final image. Only used when mode is `creative`. | `"string"` |

#### Example Snippet

Expand All @@ -76,7 +76,6 @@ const res = await client.v1.aiImageUpscaler.create({
assets: { imageFilePath: "api-assets/id/1234.png" },
name: "My Image Upscaler image",
scaleFactor: 2.0,
style: { mode: "creative" },
});
```

Expand Down
10 changes: 5 additions & 5 deletions src/resources/v1/ai-image-upscaler/request-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ export type CreateRequest = {
*/
scaleFactor: number;
/**
* Style settings for the upscale. Use `mode` to select between `"pro"` (faster, no enhancement required) and `"creative"` (defaults to `"Balanced"` enhancement). Defaults to `"creative"`.
* Style settings for the upscale. Use `mode` (`"preserve"`, `"balanced"`, or `"creative"`). Defaults to `"balanced"`.
*/
style: V1AiImageUpscalerCreateBodyStyle;
style?: V1AiImageUpscalerCreateBodyStyle | undefined;
};

/**
Expand All @@ -45,7 +45,7 @@ export type External$CreateRequest = {
assets: External$V1AiImageUpscalerCreateBodyAssets;
name?: string | undefined;
scale_factor: number;
style: External$V1AiImageUpscalerCreateBodyStyle;
style?: External$V1AiImageUpscalerCreateBodyStyle | undefined;
};

/**
Expand All @@ -60,7 +60,7 @@ const SchemaIn$CreateRequest: z.ZodType<
assets: Schemas$V1AiImageUpscalerCreateBodyAssets.in,
name: z.string().optional(),
scale_factor: z.number(),
style: Schemas$V1AiImageUpscalerCreateBodyStyle.in,
style: Schemas$V1AiImageUpscalerCreateBodyStyle.in.optional(),
})
.transform((obj) => {
return zodTransform(obj, {
Expand All @@ -84,7 +84,7 @@ const SchemaOut$CreateRequest: z.ZodType<
assets: Schemas$V1AiImageUpscalerCreateBodyAssets.out,
name: z.string().optional(),
scaleFactor: z.number(),
style: Schemas$V1AiImageUpscalerCreateBodyStyle.out,
style: Schemas$V1AiImageUpscalerCreateBodyStyle.out.optional(),
})
.transform((obj) => {
return zodTransform(obj, {
Expand Down
2 changes: 1 addition & 1 deletion src/resources/v1/ai-image-upscaler/resource-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export class AiImageUpscalerClient extends CoreResourceClient {
/**
* AI Image Upscaler
*
* Upscale your image using AI. Each 2x upscale costs 50 credits, and 4x upscale costs 200 credits.
* Upscale your image using AI. Each 2x upscale costs 50 credits for balanced/creative modes, and 25 credits for preserve. 4x upscale costs 200 and 100 credits respectively.
*
* POST /v1/ai-image-upscaler
*/
Expand Down
2 changes: 1 addition & 1 deletion src/resources/v1/body-swap/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Swap a person into a scene image using Nano Banana 2. Credits depend on `resolut
| ------------------- | :------: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
| `assets` | ✓ | Person image and scene image for body swap | `{"personFilePath": "api-assets/id/1234.png", "sceneFilePath": "api-assets/id/5678.png"}` |
| `└─ personFilePath` | ✓ | Image of the person to place into the scene. This value is either - a direct URL to the video file - `file_path` field from the response of the [upload urls API](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls). See the [file upload guide](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls#input-file) for details. | `"api-assets/id/1234.png"` |
| `└─ sceneFilePath` | ✓ | Target scene image (background). This value is either - a direct URL to the video file - `file_path` field from the response of the [upload urls API](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls). See the [file upload guide](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls#input-file) for details. | `"api-assets/id/5678.png"` |
| `└─ sceneFilePath` | ✓ | Original scene image (background). This value is either - a direct URL to the video file - `file_path` field from the response of the [upload urls API](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls). See the [file upload guide](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls#input-file) for details. | `"api-assets/id/5678.png"` |
| `resolution` | ✓ | Output resolution. Determines credits charged for the run. | `"1k"` |
| `name` | ✗ | Give your image a custom name for easy identification. | `"My Body Swap image"` |

Expand Down
4 changes: 2 additions & 2 deletions src/resources/v1/files/upload-urls/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ The response array will match the order of items in the request body.
**Valid file extensions per asset type**:

- video: mp4, m4v, mov, webm
- audio: mp3, wav, aac, flac, webm, m4a, opus, ogg, aiff, amr
- image: png, jpg, jpeg, jfif, heic, heif, webp, avif, jp2, tiff, bmp
- audio: mp3, wav, aac, flac, webm, weba, m4a, opus, ogg, oga, aiff, amr
- image: png, jpg, jpeg, jfif, heic, heif, webp, avif, jp2, tiff, tif, bmp
- gif: gif, webp, webm

> Note: `gif` is only supported for face swap API `video_file_path` field.
Expand Down
4 changes: 2 additions & 2 deletions src/resources/v1/files/upload-urls/resource-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ export class UploadUrlsClient extends CoreResourceClient {
*
* **Valid file extensions per asset type**:
* - video: mp4, m4v, mov, webm
* - audio: mp3, wav, aac, flac, webm, m4a, opus, ogg, aiff, amr
* - image: png, jpg, jpeg, jfif, heic, heif, webp, avif, jp2, tiff, bmp
* - audio: mp3, wav, aac, flac, webm, weba, m4a, opus, ogg, oga, aiff, amr
* - image: png, jpg, jpeg, jfif, heic, heif, webp, avif, jp2, tiff, tif, bmp
* - gif: gif, webp, webm
*
* > Note: `gif` is only supported for face swap API `video_file_path` field.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* V1AiImageUpscalerCreateBodyStyleEnhancementEnum
* Deprecated: use `mode` instead. `"Resemblance"` maps to `"preserve"`. `"Balanced"` and `"Creative"` map to the same-named modes.
*/
export type V1AiImageUpscalerCreateBodyStyleEnhancementEnum =
| "Balanced"
Expand Down
8 changes: 6 additions & 2 deletions src/types/v1-ai-image-upscaler-create-body-style-mode-enum.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
/**
* The upscaling mode. `"pro"` is faster and does not require `enhancement`. `"creative"` requires `enhancement`. Defaults to `"creative"`.
* The upscaling mode. `"preserve"` uses the fast pro pipeline (1× credit multiplier). `"balanced"` and `"creative"` use the creative pipeline (2× credit multiplier). `"pro"` is deprecated and maps to `"preserve"`. Defaults to `"balanced"`.
*/
export type V1AiImageUpscalerCreateBodyStyleModeEnum = "creative" | "pro";
export type V1AiImageUpscalerCreateBodyStyleModeEnum =
| "balanced"
| "creative"
| "preserve"
| "pro";
17 changes: 10 additions & 7 deletions src/types/v1-ai-image-upscaler-create-body-style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@ import { zodTransform } from "make-api-request-js";
import * as z from "zod";

/**
* Style settings for the upscale. Use `mode` to select between `"pro"` (faster, no enhancement required) and `"creative"` (defaults to `"Balanced"` enhancement). Defaults to `"creative"`.
* Style settings for the upscale. Use `mode` (`"preserve"`, `"balanced"`, or `"creative"`). Defaults to `"balanced"`.
*/
export type V1AiImageUpscalerCreateBodyStyle = {
/**
* Deprecated: use `mode` instead. `"Resemblance"` maps to `"preserve"`. `"Balanced"` and `"Creative"` map to the same-named modes.
*/
enhancement?: ("Balanced" | "Creative" | "Resemblance") | undefined;
/**
* The upscaling mode. `"pro"` is faster and does not require `enhancement`. `"creative"` requires `enhancement`. Defaults to `"creative"`.
* The upscaling mode. `"preserve"` uses the fast pro pipeline (1× credit multiplier). `"balanced"` and `"creative"` use the creative pipeline (2× credit multiplier). `"pro"` is deprecated and maps to `"preserve"`. Defaults to `"balanced"`.
*/
mode?: ("creative" | "pro") | undefined;
mode?: ("balanced" | "creative" | "preserve" | "pro") | undefined;
/**
* A prompt to guide the final image. This value is ignored if `enhancement` is not Creative
* A prompt to guide the final image. Only used when mode is `creative`.
*/
prompt?: string | undefined;
};
Expand All @@ -23,7 +26,7 @@ export type V1AiImageUpscalerCreateBodyStyle = {
*/
export type External$V1AiImageUpscalerCreateBodyStyle = {
enhancement?: ("Balanced" | "Creative" | "Resemblance") | undefined;
mode?: ("creative" | "pro") | undefined;
mode?: ("balanced" | "creative" | "preserve" | "pro") | undefined;
prompt?: string | undefined;
};

Expand All @@ -37,7 +40,7 @@ const SchemaIn$V1AiImageUpscalerCreateBodyStyle: z.ZodType<
> = z
.object({
enhancement: z.enum(["Balanced", "Creative", "Resemblance"]).optional(),
mode: z.enum(["creative", "pro"]).optional(),
mode: z.enum(["balanced", "creative", "preserve", "pro"]).optional(),
prompt: z.string().optional(),
})
.transform((obj) => {
Expand All @@ -59,7 +62,7 @@ const SchemaOut$V1AiImageUpscalerCreateBodyStyle: z.ZodType<
> = z
.object({
enhancement: z.enum(["Balanced", "Creative", "Resemblance"]).optional(),
mode: z.enum(["creative", "pro"]).optional(),
mode: z.enum(["balanced", "creative", "preserve", "pro"]).optional(),
prompt: z.string().optional(),
})
.transform((obj) => {
Expand Down
10 changes: 5 additions & 5 deletions src/types/v1-ai-image-upscaler-create-body.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ export type V1AiImageUpscalerCreateBody = {
*/
scaleFactor: number;
/**
* Style settings for the upscale. Use `mode` to select between `"pro"` (faster, no enhancement required) and `"creative"` (defaults to `"Balanced"` enhancement). Defaults to `"creative"`.
* Style settings for the upscale. Use `mode` (`"preserve"`, `"balanced"`, or `"creative"`). Defaults to `"balanced"`.
*/
style: V1AiImageUpscalerCreateBodyStyle;
style?: V1AiImageUpscalerCreateBodyStyle | undefined;
};

/**
Expand All @@ -45,7 +45,7 @@ export type External$V1AiImageUpscalerCreateBody = {
assets: External$V1AiImageUpscalerCreateBodyAssets;
name?: string | undefined;
scale_factor: number;
style: External$V1AiImageUpscalerCreateBodyStyle;
style?: External$V1AiImageUpscalerCreateBodyStyle | undefined;
};

/**
Expand All @@ -60,7 +60,7 @@ const SchemaIn$V1AiImageUpscalerCreateBody: z.ZodType<
assets: Schemas$V1AiImageUpscalerCreateBodyAssets.in,
name: z.string().optional(),
scale_factor: z.number(),
style: Schemas$V1AiImageUpscalerCreateBodyStyle.in,
style: Schemas$V1AiImageUpscalerCreateBodyStyle.in.optional(),
})
.transform((obj) => {
return zodTransform(obj, {
Expand All @@ -84,7 +84,7 @@ const SchemaOut$V1AiImageUpscalerCreateBody: z.ZodType<
assets: Schemas$V1AiImageUpscalerCreateBodyAssets.out,
name: z.string().optional(),
scaleFactor: z.number(),
style: Schemas$V1AiImageUpscalerCreateBodyStyle.out,
style: Schemas$V1AiImageUpscalerCreateBodyStyle.out.optional(),
})
.transform((obj) => {
return zodTransform(obj, {
Expand Down
2 changes: 1 addition & 1 deletion src/types/v1-body-swap-create-body-assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export type V1BodySwapCreateBodyAssets = {
*/
personFilePath: string;
/**
* Target scene image (background). This value is either
* Original scene image (background). This value is either
* - a direct URL to the video file
* - `file_path` field from the response of the [upload urls API](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls).
*
Expand Down
2 changes: 1 addition & 1 deletion src/types/v1-files-upload-urls-create-body-items-item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import * as z from "zod";
*/
export type V1FilesUploadUrlsCreateBodyItemsItem = {
/**
* The extension of the file to upload. Do not include the dot (.) before the extension. Possible extensions are mp4,m4v,mov,webm,mp3,wav,aac,flac,webm,m4a,opus,ogg,aiff,amr,png,jpg,jpeg,jfif,heic,heif,webp,avif,jp2,tiff,bmp,gif,webp,webm
* The extension of the file to upload. Do not include the dot (.) before the extension. Possible extensions are mp4,m4v,mov,webm,mp3,wav,aac,flac,webm,weba,m4a,opus,ogg,oga,aiff,amr,png,jpg,jpeg,jfif,heic,heif,webp,avif,jp2,tiff,tif,bmp,gif,webp,webm
*/
extension: string;
/**
Expand Down
Loading
Loading