@shotstack/schemas 1.22.0 → 1.23.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.
@@ -801,7 +801,7 @@
801
801
  }
802
802
  }
803
803
  },
804
- "description": "Generate a single image, video or audio asset from a text prompt without\nrendering a full edit. Submit a prompt-bearing asset; the response is\nimmediate when an identical asset has been generated before (results are\ncached by prompt, model and options), otherwise the job is queued and can\nbe polled via the status endpoint.\n\nGeneration is billed in credits per asset. Identical repeat requests\nresolve from the cache at no charge.\n\n**Base URL:** <a href=\"#\">https://api.shotstack.io/edit/{version}</a>\n",
804
+ "description": "Generate a single image, video or audio asset from a prompt or, for some models, a source file, without\nrendering a full edit. Submit an asset with a prompt or source file; the response is\nimmediate when an identical asset has been generated before (results are\ncached by prompt, model and options), otherwise the job is queued and can\nbe polled via the status endpoint.\n\nGeneration is billed in credits per asset. Identical repeat requests\nresolve from the cache at no charge.\n\n**Base URL:** <a href=\"#\">https://api.shotstack.io/edit/{version}</a>\n",
805
805
  "summary": "Generate Asset",
806
806
  "operationId": "postGenerate",
807
807
  "parameters": [
@@ -967,7 +967,7 @@
967
967
  },
968
968
  "/models": {
969
969
  "get": {
970
- "description": "List the generation models available for `prompt`-bearing image, video and audio\nassets, with the options each accepts. Use `POST /generate/quote` for a credit estimate.\n\nUse this to populate a model picker and render its option fields, rather than\nhard coding a model list. A newly launched model appears here without any change\non your side. Each entry carries the asset type it generates, so filter the list\nclient side when a picker only needs one kind.\n\nOption schemas are omitted by default. Request them with `expand=options`.\n\nEach model's `available` reflects the plan of the account behind the calling API\nkey, so offer only the models it marks available.\n\n**Base URL:** <a href=\"#\">https://api.shotstack.io/edit/{version}</a>\n",
970
+ "description": "List the generation models available for `prompt`-bearing image, video and audio\nassets generated from a prompt or, for some models, a source file, with the options each accepts. Use `POST /generate/quote` for a credit estimate.\n\nUse this to populate a model picker and render its option fields, rather than\nhard coding a model list. A newly launched model appears here without any change\non your side. Each entry carries the asset type it generates, so filter the list\nclient side when a picker only needs one kind.\n\nOption schemas are omitted by default. Request them with `expand=options`.\n\nEach model's `available` reflects the plan of the account behind the calling API\nkey, so offer only the models it marks available.\n\n**Base URL:** <a href=\"#\">https://api.shotstack.io/edit/{version}</a>\n",
971
971
  "summary": "List Generation Models",
972
972
  "operationId": "getModels",
973
973
  "responses": {
@@ -5144,7 +5144,7 @@
5144
5144
  "type": "object"
5145
5145
  },
5146
5146
  "GenerationAsset": {
5147
- "description": "An image, video or audio asset to generate from a text prompt.",
5147
+ "description": "An asset to generate, from a text `prompt` or, for models that take one, a source `src`.",
5148
5148
  "type": "object",
5149
5149
  "properties": {
5150
5150
  "type": {
@@ -5165,6 +5165,11 @@
5165
5165
  "pattern": "\\S",
5166
5166
  "example": "A lighthouse on a rocky coast at sunset, cinematic lighting"
5167
5167
  },
5168
+ "src": {
5169
+ "description": "The source file for models that take one instead of a prompt, such as `shotstack-music-analysis`. A public HTTPS URL.",
5170
+ "type": "string",
5171
+ "format": "uri"
5172
+ },
5168
5173
  "model": {
5169
5174
  "description": "The generation model. Defaults to `nano-banana-2` for images, `seedance-2.0-text-to-video` for video and `elevenlabs-multilingual-v2` for audio. `GET /models` lists the models for each type.",
5170
5175
  "type": "string",
@@ -5181,12 +5186,11 @@
5181
5186
  },
5182
5187
  "additionalProperties": false,
5183
5188
  "required": [
5184
- "type",
5185
- "prompt"
5189
+ "type"
5186
5190
  ]
5187
5191
  },
5188
5192
  "GenerationModel": {
5189
- "description": "A generation model available to `prompt`-bearing image, video and audio assets, with the options it accepts. Use `POST /generate/quote` for a credit estimate. Render a model picker and its option fields from this rather than hard coding a model list, so a newly launched model is available without a client release.",
5193
+ "description": "A generation model available to image, video and audio assets generated from a prompt or, for some models, a source file, with the options it accepts. Use `POST /generate/quote` for a credit estimate. Render a model picker and its option fields from this rather than hard coding a model list, so a newly launched model is available without a client release.",
5190
5194
  "properties": {
5191
5195
  "model": {
5192
5196
  "description": "The identifier to set as the asset `model`. Carries no provider name, so routing can change without a public rename.",
package/dist/schema.d.ts CHANGED
@@ -202,8 +202,8 @@ export interface paths {
202
202
  put?: never;
203
203
  /**
204
204
  * Generate Asset
205
- * @description Generate a single image, video or audio asset from a text prompt without
206
- * rendering a full edit. Submit a prompt-bearing asset; the response is
205
+ * @description Generate a single image, video or audio asset from a prompt or, for some models, a source file, without
206
+ * rendering a full edit. Submit an asset with a prompt or source file; the response is
207
207
  * immediate when an identical asset has been generated before (results are
208
208
  * cached by prompt, model and options), otherwise the job is queued and can
209
209
  * be polled via the status endpoint.
@@ -290,7 +290,7 @@ export interface paths {
290
290
  /**
291
291
  * List Generation Models
292
292
  * @description List the generation models available for `prompt`-bearing image, video and audio
293
- * assets, with the options each accepts. Use `POST /generate/quote` for a credit estimate.
293
+ * assets generated from a prompt or, for some models, a source file, with the options each accepts. Use `POST /generate/quote` for a credit estimate.
294
294
  *
295
295
  * Use this to populate a model picker and render its option fields, rather than
296
296
  * hard coding a model list. A newly launched model appears here without any change
@@ -3000,7 +3000,7 @@ export interface components {
3000
3000
  /** @description Specify the storage locations and hosting services to send the file to. */
3001
3001
  destinations: components["schemas"]["Destinations"][];
3002
3002
  };
3003
- /** @description An image, video or audio asset to generate from a text prompt. */
3003
+ /** @description An asset to generate, from a text `prompt` or, for models that take one, a source `src`. */
3004
3004
  GenerationAsset: {
3005
3005
  /**
3006
3006
  * @description The kind of asset to generate.
@@ -3012,7 +3012,12 @@ export interface components {
3012
3012
  * @description A description of the asset to generate. For text-to-speech models it is the text spoken.
3013
3013
  * @example A lighthouse on a rocky coast at sunset, cinematic lighting
3014
3014
  */
3015
- prompt: string;
3015
+ prompt?: string;
3016
+ /**
3017
+ * Format: uri
3018
+ * @description The source file for models that take one instead of a prompt, such as `shotstack-music-analysis`. A public HTTPS URL.
3019
+ */
3020
+ src?: string;
3016
3021
  /**
3017
3022
  * @description The generation model. Defaults to `nano-banana-2` for images, `seedance-2.0-text-to-video` for video and `elevenlabs-multilingual-v2` for audio. `GET /models` lists the models for each type.
3018
3023
  * @example nano-banana-2
@@ -3028,7 +3033,7 @@ export interface components {
3028
3033
  [key: string]: unknown;
3029
3034
  };
3030
3035
  };
3031
- /** @description A generation model available to `prompt`-bearing image, video and audio assets, with the options it accepts. Use `POST /generate/quote` for a credit estimate. Render a model picker and its option fields from this rather than hard coding a model list, so a newly launched model is available without a client release. */
3036
+ /** @description A generation model available to image, video and audio assets generated from a prompt or, for some models, a source file, with the options it accepts. Use `POST /generate/quote` for a credit estimate. Render a model picker and its option fields from this rather than hard coding a model list, so a newly launched model is available without a client release. */
3032
3037
  GenerationModel: {
3033
3038
  /**
3034
3039
  * @description The identifier to set as the asset `model`. Carries no provider name, so routing can change without a public rename.
@@ -442,7 +442,7 @@ exports.fontFontSchema = zod_1.z.object({
442
442
  }).strict();
443
443
  exports.fontSchema = exports.fontFontSchema;
444
444
  /**
445
- * An image, video or audio asset to generate from a text prompt.
445
+ * An asset to generate, from a text `prompt` or, for models that take one, a source `src`.
446
446
  */
447
447
  exports.generationassetGenerationAssetSchema = zod_1.z.object({
448
448
  type: zod_1.z.enum([
@@ -450,13 +450,24 @@ exports.generationassetGenerationAssetSchema = zod_1.z.object({
450
450
  'video',
451
451
  'audio'
452
452
  ]),
453
- prompt: zod_1.z.string().min(1).max(4000).regex(/\S/),
453
+ prompt: zod_1.z.optional(zod_1.z.string().min(1).max(4000).regex(/\S/)),
454
+ src: zod_1.z.optional(zod_1.z.url()),
454
455
  model: zod_1.z.optional(zod_1.z.string()),
455
456
  options: zod_1.z.optional(zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()))
456
- }).strict();
457
+ }).strict().superRefine((data, ctx) => {
458
+ var hasSrc = typeof data.src === "string" && data.src.trim().length > 0;
459
+ var hasPrompt = typeof data.prompt === "string" && data.prompt.trim().length > 0;
460
+ if (!hasSrc && !hasPrompt) {
461
+ ctx.addIssue({
462
+ code: zod_1.z.ZodIssueCode.custom,
463
+ message: "A media asset requires either \"src\" (a source URL) or \"prompt\" (to generate the asset). Provide one.",
464
+ path: ["src"],
465
+ });
466
+ }
467
+ });
457
468
  exports.generationAssetSchema = exports.generationassetGenerationAssetSchema;
458
469
  /**
459
- * A generation model available to `prompt`-bearing image, video and audio assets, with the options it accepts. Use `POST /generate/quote` for a credit estimate. Render a model picker and its option fields from this rather than hard coding a model list, so a newly launched model is available without a client release.
470
+ * A generation model available to image, video and audio assets generated from a prompt or, for some models, a source file, with the options it accepts. Use `POST /generate/quote` for a credit estimate. Render a model picker and its option fields from this rather than hard coding a model list, so a newly launched model is available without a client release.
460
471
  */
461
472
  exports.generationmodelGenerationModelSchema = zod_1.z.object({
462
473
  model: zod_1.z.string(),
@@ -774,7 +774,7 @@ export declare const fontSchema: z.ZodObject<{
774
774
  src: z.ZodString;
775
775
  }, z.core.$strict>;
776
776
  /**
777
- * An image, video or audio asset to generate from a text prompt.
777
+ * An asset to generate, from a text `prompt` or, for models that take one, a source `src`.
778
778
  */
779
779
  export declare const generationassetGenerationAssetSchema: z.ZodObject<{
780
780
  type: z.ZodEnum<{
@@ -782,7 +782,8 @@ export declare const generationassetGenerationAssetSchema: z.ZodObject<{
782
782
  video: "video";
783
783
  audio: "audio";
784
784
  }>;
785
- prompt: z.ZodString;
785
+ prompt: z.ZodOptional<z.ZodString>;
786
+ src: z.ZodOptional<z.ZodURL>;
786
787
  model: z.ZodOptional<z.ZodString>;
787
788
  options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
788
789
  }, z.core.$strict>;
@@ -792,12 +793,13 @@ export declare const generationAssetSchema: z.ZodObject<{
792
793
  video: "video";
793
794
  audio: "audio";
794
795
  }>;
795
- prompt: z.ZodString;
796
+ prompt: z.ZodOptional<z.ZodString>;
797
+ src: z.ZodOptional<z.ZodURL>;
796
798
  model: z.ZodOptional<z.ZodString>;
797
799
  options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
798
800
  }, z.core.$strict>;
799
801
  /**
800
- * A generation model available to `prompt`-bearing image, video and audio assets, with the options it accepts. Use `POST /generate/quote` for a credit estimate. Render a model picker and its option fields from this rather than hard coding a model list, so a newly launched model is available without a client release.
802
+ * A generation model available to image, video and audio assets generated from a prompt or, for some models, a source file, with the options it accepts. Use `POST /generate/quote` for a credit estimate. Render a model picker and its option fields from this rather than hard coding a model list, so a newly launched model is available without a client release.
801
803
  */
802
804
  export declare const generationmodelGenerationModelSchema: z.ZodObject<{
803
805
  model: z.ZodString;
@@ -840,7 +842,8 @@ export declare const generationrequestGenerationRequestSchema: z.ZodObject<{
840
842
  video: "video";
841
843
  audio: "audio";
842
844
  }>;
843
- prompt: z.ZodString;
845
+ prompt: z.ZodOptional<z.ZodString>;
846
+ src: z.ZodOptional<z.ZodURL>;
844
847
  model: z.ZodOptional<z.ZodString>;
845
848
  options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
846
849
  }, z.core.$strict>;
@@ -853,7 +856,8 @@ export declare const generationRequestSchema: z.ZodObject<{
853
856
  video: "video";
854
857
  audio: "audio";
855
858
  }>;
856
- prompt: z.ZodString;
859
+ prompt: z.ZodOptional<z.ZodString>;
860
+ src: z.ZodOptional<z.ZodURL>;
857
861
  model: z.ZodOptional<z.ZodString>;
858
862
  options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
859
863
  }, z.core.$strict>;
@@ -61823,7 +61827,8 @@ export declare const postGenerateRequest: z.ZodObject<{
61823
61827
  video: "video";
61824
61828
  audio: "audio";
61825
61829
  }>;
61826
- prompt: z.ZodString;
61830
+ prompt: z.ZodOptional<z.ZodString>;
61831
+ src: z.ZodOptional<z.ZodURL>;
61827
61832
  model: z.ZodOptional<z.ZodString>;
61828
61833
  options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
61829
61834
  }, z.core.$strict>;
@@ -61857,7 +61862,8 @@ export declare const postGenerateQuoteRequest: z.ZodObject<{
61857
61862
  video: "video";
61858
61863
  audio: "audio";
61859
61864
  }>;
61860
- prompt: z.ZodString;
61865
+ prompt: z.ZodOptional<z.ZodString>;
61866
+ src: z.ZodOptional<z.ZodURL>;
61861
61867
  model: z.ZodOptional<z.ZodString>;
61862
61868
  options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
61863
61869
  }, z.core.$strict>;
@@ -433,7 +433,7 @@ export const fontFontSchema = z.object({
433
433
  }).strict();
434
434
  export const fontSchema = fontFontSchema;
435
435
  /**
436
- * An image, video or audio asset to generate from a text prompt.
436
+ * An asset to generate, from a text `prompt` or, for models that take one, a source `src`.
437
437
  */
438
438
  export const generationassetGenerationAssetSchema = z.object({
439
439
  type: z.enum([
@@ -441,13 +441,24 @@ export const generationassetGenerationAssetSchema = z.object({
441
441
  'video',
442
442
  'audio'
443
443
  ]),
444
- prompt: z.string().min(1).max(4000).regex(/\S/),
444
+ prompt: z.optional(z.string().min(1).max(4000).regex(/\S/)),
445
+ src: z.optional(z.url()),
445
446
  model: z.optional(z.string()),
446
447
  options: z.optional(z.record(z.string(), z.unknown()))
447
- }).strict();
448
+ }).strict().superRefine((data, ctx) => {
449
+ var hasSrc = typeof data.src === "string" && data.src.trim().length > 0;
450
+ var hasPrompt = typeof data.prompt === "string" && data.prompt.trim().length > 0;
451
+ if (!hasSrc && !hasPrompt) {
452
+ ctx.addIssue({
453
+ code: z.ZodIssueCode.custom,
454
+ message: "A media asset requires either \"src\" (a source URL) or \"prompt\" (to generate the asset). Provide one.",
455
+ path: ["src"],
456
+ });
457
+ }
458
+ });
448
459
  export const generationAssetSchema = generationassetGenerationAssetSchema;
449
460
  /**
450
- * A generation model available to `prompt`-bearing image, video and audio assets, with the options it accepts. Use `POST /generate/quote` for a credit estimate. Render a model picker and its option fields from this rather than hard coding a model list, so a newly launched model is available without a client release.
461
+ * A generation model available to image, video and audio assets generated from a prompt or, for some models, a source file, with the options it accepts. Use `POST /generate/quote` for a credit estimate. Render a model picker and its option fields from this rather than hard coding a model list, so a newly launched model is available without a client release.
451
462
  */
452
463
  export const generationmodelGenerationModelSchema = z.object({
453
464
  model: z.string(),
@@ -394,7 +394,7 @@ export const fontFontSchema = z.object({
394
394
  export const fontSchema = fontFontSchema;
395
395
 
396
396
  /**
397
- * An image, video or audio asset to generate from a text prompt.
397
+ * An asset to generate, from a text `prompt` or, for models that take one, a source `src`.
398
398
  */
399
399
  export const generationassetGenerationAssetSchema = z.object({
400
400
  type: z.enum([
@@ -402,15 +402,26 @@ export const generationassetGenerationAssetSchema = z.object({
402
402
  'video',
403
403
  'audio'
404
404
  ]),
405
- prompt: z.string().min(1).max(4000).regex(/\S/),
405
+ prompt: z.optional(z.string().min(1).max(4000).regex(/\S/)),
406
+ src: z.optional(z.url()),
406
407
  model: z.optional(z.string()),
407
408
  options: z.optional(z.record(z.string(), z.unknown()))
408
- }).strict();
409
+ }).strict().superRefine((data, ctx) => {
410
+ var hasSrc = typeof data.src === "string" && data.src.trim().length > 0;
411
+ var hasPrompt = typeof data.prompt === "string" && data.prompt.trim().length > 0;
412
+ if (!hasSrc && !hasPrompt) {
413
+ ctx.addIssue({
414
+ code: z.ZodIssueCode.custom,
415
+ message: "A media asset requires either \"src\" (a source URL) or \"prompt\" (to generate the asset). Provide one.",
416
+ path: ["src"],
417
+ });
418
+ }
419
+ });
409
420
 
410
421
  export const generationAssetSchema = generationassetGenerationAssetSchema;
411
422
 
412
423
  /**
413
- * A generation model available to `prompt`-bearing image, video and audio assets, with the options it accepts. Use `POST /generate/quote` for a credit estimate. Render a model picker and its option fields from this rather than hard coding a model list, so a newly launched model is available without a client release.
424
+ * A generation model available to image, video and audio assets generated from a prompt or, for some models, a source file, with the options it accepts. Use `POST /generate/quote` for a credit estimate. Render a model picker and its option fields from this rather than hard coding a model list, so a newly launched model is available without a client release.
414
425
  */
415
426
  export const generationmodelGenerationModelSchema = z.object({
416
427
  model: z.string(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shotstack/schemas",
3
- "version": "1.22.0",
3
+ "version": "1.23.0",
4
4
  "description": "Centralized OpenAPI schemas and TypeScript types for Shotstack API",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",