Skip to content

Commit 0eb0938

Browse files
feat(api): api update
1 parent 4cfaad5 commit 0eb0938

4 files changed

Lines changed: 118 additions & 25 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 2
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/fashn/fashn-sdk-3add3c2ba2bcebda859e6c6c04e71f8e5f865d4a0edb7fe8ec5ba2e1985d00ca.yml
3-
openapi_spec_hash: 06d789906d61e3fefdfb789d532da5fe
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/fashn/fashn-sdk-c1e5a54d159efed8e9803ae5c34a94bad33a8c14a3fcef7331868db4d724ffc4.yml
3+
openapi_spec_hash: 58c9627440e1c4a21f879fcb900e3bdc
44
config_hash: 6f35cc512a77534117eeac956e613816

packages/mcp-server/src/local-docs-search.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ const EMBEDDED_METHODS: MethodEntry[] = [
5656
httpMethod: 'post',
5757
summary: 'Create a new prediction',
5858
description:
59-
'Submit a prediction request for AI-powered fashion processing. Supports multiple model types including:\n- Try-on max (tryon-max)\n- Virtual try-on v1.6 (tryon-v1.6)\n- Model creation (model-create)\n- Model swap (model-swap)\n- Product to model (product-to-model)\n- Face to model (face-to-model)\n- Background operations (background-remove, background-change)\n- Image reframing (reframe)\n- Image to video (image-to-video)\n- Image editing (edit)\n\nAll requests use the versioned format with model_name and inputs structure.\n',
59+
'Submit a prediction request for AI-powered fashion processing. Supports multiple model types including:\n- Try-on max (tryon-max)\n- Virtual try-on v1.6 (tryon-v1.6)\n- Model creation (model-create)\n- Model swap (model-swap)\n- Product to model (product-to-model)\n- Face to model (face-to-model)\n- Background operations (background-remove, background-change)\n- Image reframing (reframe)\n- Image to video (image-to-video)\n- Image editing (edit)\n- Product packshot (packshot)\n\nAll requests use the versioned format with model_name and inputs structure.\n',
6060
stainlessPath: '(resource) predictions > (method) run',
6161
qualified: 'client.predictions.run',
6262
params: [
63-
"body: { inputs: { model_image: string; product_image: string; aspect_ratio?: '21:9' | '1:1' | '4:3' | '3:2' | '2:3' | '5:4' | '4:5' | '3:4' | '16:9' | '9:16'; generation_mode?: 'balanced' | 'quality'; num_images?: number; output_format?: 'png' | 'jpeg'; prompt?: string; resolution?: '1k' | '2k' | '4k'; return_base64?: boolean; seed?: number; }; model_name: 'tryon-max'; } | { inputs: { garment_image: string; model_image: string; category?: 'auto' | 'tops' | 'bottoms' | 'one-pieces'; garment_photo_type?: 'auto' | 'flat-lay' | 'model'; mode?: 'performance' | 'balanced' | 'quality'; moderation_level?: 'conservative' | 'permissive' | 'none'; num_samples?: number; output_format?: 'png' | 'jpeg'; return_base64?: boolean; seed?: number; segmentation_free?: boolean; }; model_name: 'tryon-v1.6'; } | { inputs: { product_image: string; aspect_ratio?: '1:1' | '2:3' | '3:4' | '4:5' | '5:4' | '4:3' | '3:2' | '16:9' | '9:16'; generation_mode?: 'fast' | 'balanced' | 'quality'; image_prompt?: string; model_image?: string; output_format?: 'png' | 'jpeg'; prompt?: string; resolution?: '1k' | '2k' | '4k'; return_base64?: boolean; seed?: number; }; model_name: 'product-to-model'; } | { inputs: { face_image: string; aspect_ratio?: '1:1' | '4:5' | '3:4' | '2:3' | '9:16'; generation_mode?: 'fast' | 'balanced' | 'quality'; num_images?: number; output_format?: 'png' | 'jpeg'; prompt?: string; resolution?: '1k' | '2k' | '4k'; return_base64?: boolean; seed?: number; }; model_name: 'face-to-model'; } | { inputs: { prompt: string; aspect_ratio?: '1:1' | '2:3' | '3:4' | '4:5' | '5:4' | '4:3' | '3:2' | '16:9' | '9:16'; face_reference?: string; face_reference_mode?: 'match_base' | 'match_reference'; generation_mode?: 'fast' | 'balanced' | 'quality'; image_reference?: string; num_images?: number; output_format?: 'png' | 'jpeg'; resolution?: '1k' | '2k' | '4k'; return_base64?: boolean; seed?: number; }; model_name: 'model-create'; } | { inputs: { model_image: string; aspect_ratio?: '21:9' | '1:1' | '4:3' | '3:2' | '2:3' | '5:4' | '4:5' | '3:4' | '16:9' | '9:16'; face_reference?: string; face_reference_mode?: 'match_base' | 'match_reference'; generation_mode?: 'fast' | 'balanced' | 'quality'; num_images?: number; output_format?: 'png' | 'jpeg'; prompt?: string; resolution?: '1k' | '2k' | '4k'; return_base64?: boolean; seed?: number; }; model_name: 'model-swap'; } | { inputs: { aspect_ratio: '21:9' | '1:1' | '4:3' | '3:2' | '2:3' | '5:4' | '4:5' | '3:4' | '16:9' | '9:16'; image: string; generation_mode?: 'fast' | 'balanced' | 'quality'; num_images?: number; output_format?: 'png' | 'jpeg'; return_base64?: boolean; seed?: number; }; model_name: 'reframe'; } | { inputs: { image: string; prompt: string; generation_mode?: 'fast' | 'balanced' | 'quality'; num_images?: number; output_format?: 'png' | 'jpeg'; resolution?: '1k' | '2k' | '4k'; return_base64?: boolean; seed?: number; }; model_name: 'background-change'; } | { inputs: { image: string; return_base64?: boolean; }; model_name: 'background-remove'; } | { inputs: { image: string; duration?: 5 | 10; end_image?: string; negative_prompt?: string; prompt?: string; resolution?: '480p' | '720p' | '1080p'; seed?: number; }; model_name: 'image-to-video'; } | { inputs: { image: string; prompt: string; aspect_ratio?: '21:9' | '1:1' | '4:3' | '3:2' | '2:3' | '5:4' | '4:5' | '3:4' | '16:9' | '9:16'; generation_mode?: 'fast' | 'balanced' | 'quality'; image_context?: string; mask?: string; num_images?: number; output_format?: 'png' | 'jpeg'; resolution?: '1k' | '2k' | '4k'; return_base64?: boolean; seed?: number; }; model_name: 'edit'; };",
63+
"body: { inputs: { model_image: string; product_image: string; aspect_ratio?: '21:9' | '1:1' | '4:3' | '3:2' | '2:3' | '5:4' | '4:5' | '3:4' | '16:9' | '9:16'; generation_mode?: 'balanced' | 'quality'; num_images?: number; output_format?: 'png' | 'jpeg'; prompt?: string; resolution?: '1k' | '2k' | '4k'; return_base64?: boolean; seed?: number; }; model_name: 'tryon-max'; } | { inputs: { garment_image: string; model_image: string; category?: 'auto' | 'tops' | 'bottoms' | 'one-pieces'; garment_photo_type?: 'auto' | 'flat-lay' | 'model'; mode?: 'performance' | 'balanced' | 'quality'; moderation_level?: 'conservative' | 'permissive' | 'none'; num_samples?: number; output_format?: 'png' | 'jpeg'; return_base64?: boolean; seed?: number; segmentation_free?: boolean; }; model_name: 'tryon-v1.6'; } | { inputs: { product_image: string; aspect_ratio?: '21:9' | '1:1' | '4:3' | '3:2' | '2:3' | '5:4' | '4:5' | '3:4' | '16:9' | '9:16'; generation_mode?: 'fast' | 'balanced' | 'quality'; image_prompt?: string; model_image?: string; output_format?: 'png' | 'jpeg'; prompt?: string; resolution?: '1k' | '2k' | '4k'; return_base64?: boolean; seed?: number; }; model_name: 'product-to-model'; } | { inputs: { face_image: string; aspect_ratio?: '21:9' | '1:1' | '4:3' | '3:2' | '2:3' | '5:4' | '4:5' | '3:4' | '16:9' | '9:16'; generation_mode?: 'fast' | 'balanced' | 'quality'; num_images?: number; output_format?: 'png' | 'jpeg'; prompt?: string; resolution?: '1k' | '2k' | '4k'; return_base64?: boolean; seed?: number; }; model_name: 'face-to-model'; } | { inputs: { prompt: string; aspect_ratio?: '21:9' | '1:1' | '4:3' | '3:2' | '2:3' | '5:4' | '4:5' | '3:4' | '16:9' | '9:16'; face_reference?: string; face_reference_mode?: 'match_base' | 'match_reference'; generation_mode?: 'fast' | 'balanced' | 'quality'; image_reference?: string; num_images?: number; output_format?: 'png' | 'jpeg'; resolution?: '1k' | '2k' | '4k'; return_base64?: boolean; seed?: number; }; model_name: 'model-create'; } | { inputs: { model_image: string; aspect_ratio?: '21:9' | '1:1' | '4:3' | '3:2' | '2:3' | '5:4' | '4:5' | '3:4' | '16:9' | '9:16'; face_reference?: string; face_reference_mode?: 'match_base' | 'match_reference'; generation_mode?: 'fast' | 'balanced' | 'quality'; num_images?: number; output_format?: 'png' | 'jpeg'; prompt?: string; resolution?: '1k' | '2k' | '4k'; return_base64?: boolean; seed?: number; }; model_name: 'model-swap'; } | { inputs: { aspect_ratio: '21:9' | '1:1' | '4:3' | '3:2' | '2:3' | '5:4' | '4:5' | '3:4' | '16:9' | '9:16'; image: string; generation_mode?: 'fast' | 'balanced' | 'quality'; num_images?: number; output_format?: 'png' | 'jpeg'; return_base64?: boolean; seed?: number; }; model_name: 'reframe'; } | { inputs: { image: string; prompt: string; generation_mode?: 'fast' | 'balanced' | 'quality'; num_images?: number; output_format?: 'png' | 'jpeg'; resolution?: '1k' | '2k' | '4k'; return_base64?: boolean; seed?: number; }; model_name: 'background-change'; } | { inputs: { image: string; return_base64?: boolean; }; model_name: 'background-remove'; } | { inputs: { image: string; duration?: 5 | 10; end_image?: string; negative_prompt?: string; prompt?: string; resolution?: '480p' | '720p' | '1080p'; seed?: number; }; model_name: 'image-to-video'; } | { inputs: { image: string; prompt: string; aspect_ratio?: '21:9' | '1:1' | '4:3' | '3:2' | '2:3' | '5:4' | '4:5' | '3:4' | '16:9' | '9:16'; generation_mode?: 'fast' | 'balanced' | 'quality'; image_context?: string; mask?: string; num_images?: number; output_format?: 'png' | 'jpeg'; resolution?: '1k' | '2k' | '4k'; return_base64?: boolean; seed?: number; }; model_name: 'edit'; } | { inputs: { product_image: string; aspect_ratio?: '21:9' | '1:1' | '4:3' | '3:2' | '2:3' | '5:4' | '4:5' | '3:4' | '16:9' | '9:16'; generation_mode?: 'fast' | 'balanced' | 'quality'; image_context?: string; num_images?: number; output_format?: 'png' | 'jpeg'; prompt?: string; resolution?: '1k' | '2k' | '4k'; return_base64?: boolean; seed?: number; }; model_name: 'packshot'; };",
6464
'webhook_url?: string;',
6565
],
6666
response: '{ id: string; error: string; }',

src/resources/predictions.ts

Lines changed: 111 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export class Predictions extends APIResource {
2828
* - Image reframing (reframe)
2929
* - Image to video (image-to-video)
3030
* - Image editing (edit)
31+
* - Product packshot (packshot)
3132
*
3233
* All requests use the versioned format with model_name and inputs structure.
3334
*
@@ -332,7 +333,8 @@ export type PredictionRunParams =
332333
| PredictionRunParams.BackgroundChangeRequest
333334
| PredictionRunParams.BackgroundRemoveRequest
334335
| PredictionRunParams.ImageToVideoRequest
335-
| PredictionRunParams.EditRequest;
336+
| PredictionRunParams.EditRequest
337+
| PredictionRunParams.PackshotRequest;
336338

337339
export declare namespace PredictionRunParams {
338340
export interface TryOnMaxRequest {
@@ -384,9 +386,7 @@ export declare namespace PredictionRunParams {
384386
generation_mode?: 'balanced' | 'quality';
385387

386388
/**
387-
* Number of images to generate in a single run. Image generation has a random
388-
* element in it, so trying multiple images at once increases the chances of
389-
* getting a good result.
389+
* Number of images to generate per request (1-4).
390390
*/
391391
num_images?: number;
392392

@@ -512,9 +512,7 @@ export declare namespace PredictionRunParams {
512512
moderation_level?: 'conservative' | 'permissive' | 'none';
513513

514514
/**
515-
* Number of images to generate in a single run. Image generation has a random
516-
* element in it, so trying multiple images at once increases the chances of
517-
* getting a good result.
515+
* Number of images to generate per request (1-4).
518516
*/
519517
num_samples?: number;
520518

@@ -591,7 +589,7 @@ export declare namespace PredictionRunParams {
591589
*
592590
* **Default:** product_image's aspect ratio (standard mode only)
593591
*/
594-
aspect_ratio?: '1:1' | '2:3' | '3:4' | '4:5' | '5:4' | '4:3' | '3:2' | '16:9' | '9:16';
592+
aspect_ratio?: '21:9' | '1:1' | '4:3' | '3:2' | '2:3' | '5:4' | '4:5' | '3:4' | '16:9' | '9:16';
595593

596594
/**
597595
* Sets the generation quality level. 'quality' produces the most detailed and
@@ -692,12 +690,12 @@ export declare namespace PredictionRunParams {
692690
face_image: string;
693691

694692
/**
695-
* Desired aspect ratio for the output image. Only vertical ratios are supported.
696-
* Images will always be extended downward to fit the aspect ratio.
693+
* Desired aspect ratio for the output image. Vertical ratios (e.g. `2:3`, `3:4`,
694+
* `9:16`) produce the most natural upper-body portraits.
697695
*
698696
* **Default:** `2:3`
699697
*/
700-
aspect_ratio?: '1:1' | '4:5' | '3:4' | '2:3' | '9:16';
698+
aspect_ratio?: '21:9' | '1:1' | '4:3' | '3:2' | '2:3' | '5:4' | '4:5' | '3:4' | '16:9' | '9:16';
701699

702700
/**
703701
* Sets the generation quality level. 'quality' produces the most detailed and
@@ -795,6 +793,7 @@ export declare namespace PredictionRunParams {
795793
*
796794
* | Aspect Ratio | Resolution | Use Case |
797795
* | ------------ | ----------- | ----------------------------- |
796+
* | 21:9 | 1568 × 672 | Ultra-wide cinematic |
798797
* | 1:1 | 1024 × 1024 | Square format, social media |
799798
* | 2:3 | 832 × 1248 | Portrait, fashion photography |
800799
* | 3:4 | 880 × 1176 | Standard portrait |
@@ -805,7 +804,7 @@ export declare namespace PredictionRunParams {
805804
* | 16:9 | 1360 × 768 | Widescreen, banners |
806805
* | 9:16 | 760 × 1360 | Vertical video format |
807806
*/
808-
aspect_ratio?: '1:1' | '2:3' | '3:4' | '4:5' | '5:4' | '4:3' | '3:2' | '16:9' | '9:16';
807+
aspect_ratio?: '21:9' | '1:1' | '4:3' | '3:2' | '2:3' | '5:4' | '4:5' | '3:4' | '16:9' | '9:16';
809808

810809
/**
811810
* Optional face reference image to guide facial features in the generated model.
@@ -1062,9 +1061,7 @@ export declare namespace PredictionRunParams {
10621061
generation_mode?: 'fast' | 'balanced' | 'quality';
10631062

10641063
/**
1065-
* Number of images to generate in a single run. Image generation has a random
1066-
* element in it, so trying multiple images at once increases the chances of
1067-
* getting a good result.
1064+
* Number of images to generate per request (1-4).
10681065
*/
10691066
num_images?: number;
10701067

@@ -1353,9 +1350,96 @@ export declare namespace PredictionRunParams {
13531350
mask?: string;
13541351

13551352
/**
1356-
* Number of images to generate in a single run. Image generation has a random
1357-
* element in it, so trying multiple images at once increases the chances of
1358-
* getting a good result.
1353+
* Number of images to generate per request (1-4).
1354+
*/
1355+
num_images?: number;
1356+
1357+
/**
1358+
* Specifies the desired output image format.
1359+
*
1360+
* - `png`: Delivers the highest quality image, ideal for use cases such as content
1361+
* creation where quality is paramount.
1362+
* - `jpeg`: Provides a faster response with a slightly compressed image, more
1363+
* suitable for real-time applications.
1364+
*/
1365+
output_format?: 'png' | 'jpeg';
1366+
1367+
/**
1368+
* Resolution setting for the output image.
1369+
*/
1370+
resolution?: '1k' | '2k' | '4k';
1371+
1372+
/**
1373+
* When set to `true`, the API will return the generated image as a base64-encoded
1374+
* string instead of a CDN URL. The base64 string will be prefixed according to the
1375+
* `output_format` (e.g., `data:image/png;base64,...` or
1376+
* `data:image/jpeg;base64,...`). This option offers enhanced privacy as
1377+
* user-generated outputs are not stored on our servers when `return_base64` is
1378+
* enabled.
1379+
*/
1380+
return_base64?: boolean;
1381+
1382+
/**
1383+
* Sets random operations to a fixed state. Use the same seed to reproduce results
1384+
* with the same inputs, or different seed to force different results.
1385+
*/
1386+
seed?: number;
1387+
}
1388+
}
1389+
1390+
export interface PackshotRequest {
1391+
/**
1392+
* Body param
1393+
*/
1394+
inputs: PackshotRequest.Inputs;
1395+
1396+
/**
1397+
* Body param: Turns a product photo into a clean commercial packshot. Optionally
1398+
* accepts a style reference image to guide staging, background, and lighting.
1399+
*/
1400+
model_name: 'packshot';
1401+
1402+
/**
1403+
* Query param: Optional webhook URL to receive completion notifications
1404+
*/
1405+
webhook_url?: string;
1406+
}
1407+
1408+
export namespace PackshotRequest {
1409+
export interface Inputs {
1410+
/**
1411+
* Source product image to convert into a commercial packshot. The AI generates a
1412+
* clean studio-style presentation while preserving product identity and detail.
1413+
*
1414+
* Base64 images must include the proper prefix (e.g.,
1415+
* `data:image/jpg;base64,<YOUR_BASE64>`)
1416+
*/
1417+
product_image: string;
1418+
1419+
/**
1420+
* Optional aspect ratio for the output image.
1421+
*/
1422+
aspect_ratio?: '21:9' | '1:1' | '4:3' | '3:2' | '2:3' | '5:4' | '4:5' | '3:4' | '16:9' | '9:16';
1423+
1424+
/**
1425+
* Sets the generation quality level. 'quality' produces the most detailed and
1426+
* realistic output but takes longer to process and costs more credits. 'fast'
1427+
* prioritizes speed and lower cost.
1428+
*/
1429+
generation_mode?: 'fast' | 'balanced' | 'quality';
1430+
1431+
/**
1432+
* Optional URL or base64 of a style reference image guiding the packshot
1433+
* presentation (staging, background, lighting). The reference influences styling
1434+
* without overriding the product itself.
1435+
*
1436+
* Base64 images must include the proper prefix (e.g.,
1437+
* `data:image/jpg;base64,<YOUR_BASE64>`)
1438+
*/
1439+
image_context?: string;
1440+
1441+
/**
1442+
* Number of images to generate per request (1-4).
13591443
*/
13601444
num_images?: number;
13611445

@@ -1369,6 +1453,15 @@ export declare namespace PredictionRunParams {
13691453
*/
13701454
output_format?: 'png' | 'jpeg';
13711455

1456+
/**
1457+
* Optional natural-language description of the desired packshot styling. If empty,
1458+
* the model picks a sensible commercial default for the detected product.
1459+
*
1460+
* **Examples:** "clean white background flat-lay", "soft studio lighting on a
1461+
* beige pedestal", "isolated on a marble surface"
1462+
*/
1463+
prompt?: string;
1464+
13721465
/**
13731466
* Resolution setting for the output image.
13741467
*/

yarn.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1215,9 +1215,9 @@ baseline-browser-mapping@^2.9.0:
12151215
integrity sha512-B0xUquLkiGLgHhpPBqvl7GWegWBUNuujQ6kXd/r1U38ElPT6Ok8KZ8e+FpUGEc2ZoRQUzq/aUnaKFc/svWUGSg==
12161216

12171217
brace-expansion@^2.0.2:
1218-
version "2.1.0"
1219-
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-2.1.0.tgz#4f41a41190216ee36067ec381526fe9539c4f0ae"
1220-
integrity sha512-TN1kCZAgdgweJhWWpgKYrQaMNHcDULHkWwQIspdtjV4Y5aurRdZpjAqn6yX3FPqTA9ngHCc4hJxMAMgGfve85w==
1218+
version "2.1.1"
1219+
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-2.1.1.tgz#c68b1c4111c76aae3a6fba55d496cee10c39dad8"
1220+
integrity sha512-WR1cURNjuvBLMZBMbqM0UoE+WAfdUcEV1ccD8PVBVOI+Z3ND4+SZbN8RsfT2bMuG1qwz5RFvPukSZm5fF2D5eA==
12211221
dependencies:
12221222
balanced-match "^1.0.0"
12231223

0 commit comments

Comments
 (0)