@shop-os/modelkit 0.2.27 → 0.3.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.
- package/CHANGELOG.md +19 -0
- package/README.md +20 -1
- package/dist/catalog.cjs +288 -14
- package/dist/catalog.cjs.map +1 -1
- package/dist/catalog.d.cts +158 -2
- package/dist/catalog.d.ts +158 -2
- package/dist/catalog.js +288 -14
- package/dist/catalog.js.map +1 -1
- package/dist/index.cjs +675 -137
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +194 -2
- package/dist/index.d.ts +194 -2
- package/dist/index.js +670 -137
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/catalog.d.cts
CHANGED
|
@@ -39,7 +39,13 @@ interface UpscaleOptions {
|
|
|
39
39
|
faceEnhancementCreativity?: number;
|
|
40
40
|
faceEnhancementStrength?: number;
|
|
41
41
|
}
|
|
42
|
-
type ModelType = "text" | "image" | "video" | "audio" | "upscale" | "bg-remove"
|
|
42
|
+
type ModelType = "text" | "image" | "video" | "audio" | "upscale" | "bg-remove"
|
|
43
|
+
/** Video in, video out, no prompt: upscale, frame interpolation, SDR to HDR. */
|
|
44
|
+
| "video-tool";
|
|
45
|
+
/** What a `video-tool` row does to its source clip. */
|
|
46
|
+
type VideoToolKind = "upscale" | "interpolate" | "hdr";
|
|
47
|
+
/** Container/codec a video-tool row can write. */
|
|
48
|
+
type VideoToolOutputFormat = "h265" | "prores";
|
|
43
49
|
type Lifecycle = "active" | "deprecated" | "retired";
|
|
44
50
|
type Surface = "cowork" | "space_builder";
|
|
45
51
|
/** @deprecated use Surface[] */
|
|
@@ -130,6 +136,61 @@ interface VideoCallOptions extends Omit<VideoRequest, "model"> {
|
|
|
130
136
|
/** Reaches the provider only for AI SDK model instances; catalog rows carry their own. */
|
|
131
137
|
providerOptions?: ProviderOptions;
|
|
132
138
|
}
|
|
139
|
+
/** What the caller measured about a video-tool source; the kit never measures. */
|
|
140
|
+
interface VideoToolSource {
|
|
141
|
+
url: string;
|
|
142
|
+
width: number;
|
|
143
|
+
height: number;
|
|
144
|
+
durationSeconds: number;
|
|
145
|
+
fps?: number;
|
|
146
|
+
}
|
|
147
|
+
interface VideoToolRequest {
|
|
148
|
+
model: string;
|
|
149
|
+
source: VideoToolSource;
|
|
150
|
+
/** Upscale rows. */
|
|
151
|
+
upscaleFactor?: number;
|
|
152
|
+
/** Interpolate rows. */
|
|
153
|
+
targetFps?: number;
|
|
154
|
+
/** HDR rows; the row's first `outputFormats` entry when unset. */
|
|
155
|
+
outputFormat?: VideoToolOutputFormat;
|
|
156
|
+
}
|
|
157
|
+
/** The output a video-tool request will produce, from the request alone. */
|
|
158
|
+
interface VideoToolOutputSpec {
|
|
159
|
+
width: number;
|
|
160
|
+
height: number;
|
|
161
|
+
durationSeconds: number;
|
|
162
|
+
fps?: number;
|
|
163
|
+
resolution: VideoResolution;
|
|
164
|
+
format: "h264" | VideoToolOutputFormat;
|
|
165
|
+
}
|
|
166
|
+
interface VideoToolCallContext extends CallContext {
|
|
167
|
+
/** Where the provider posts the result when the job ends. */
|
|
168
|
+
webhookUrl?: string;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* A submitted video-tool job. Plain JSON so a caller can store it and pass it back
|
|
172
|
+
* to `videoToolStatus` / `videoToolResult` / `cancelVideoTool` from another process.
|
|
173
|
+
*/
|
|
174
|
+
interface VideoToolSubmission {
|
|
175
|
+
model: string;
|
|
176
|
+
provider: "fal";
|
|
177
|
+
requestId: string;
|
|
178
|
+
statusUrl: string;
|
|
179
|
+
responseUrl: string;
|
|
180
|
+
cancelUrl: string;
|
|
181
|
+
output: VideoToolOutputSpec;
|
|
182
|
+
}
|
|
183
|
+
type VideoToolStatus = "queued" | "running" | "completed";
|
|
184
|
+
interface VideoToolResult {
|
|
185
|
+
video: {
|
|
186
|
+
url: string;
|
|
187
|
+
mime?: string;
|
|
188
|
+
bytes?: number;
|
|
189
|
+
};
|
|
190
|
+
output: VideoToolOutputSpec;
|
|
191
|
+
usage: UsageEvent;
|
|
192
|
+
raw?: unknown;
|
|
193
|
+
}
|
|
133
194
|
interface AudioRequest {
|
|
134
195
|
model: string;
|
|
135
196
|
prompt: string;
|
|
@@ -190,6 +251,33 @@ interface ReferenceLimits {
|
|
|
190
251
|
audioOnly?: boolean;
|
|
191
252
|
/** Per-video length caps (min/max each) and combined total for reference videos. */
|
|
192
253
|
videoSeconds?: VideoSecondsLimits;
|
|
254
|
+
/** Per-clip length caps (min/max each) and combined total for reference audio, in seconds. */
|
|
255
|
+
audioSeconds?: {
|
|
256
|
+
min?: number;
|
|
257
|
+
max?: number;
|
|
258
|
+
total?: number;
|
|
259
|
+
};
|
|
260
|
+
/** File types the provider takes for reference audio, as lowercase extensions. */
|
|
261
|
+
audioFormats?: string[];
|
|
262
|
+
/** Largest reference audio file the provider takes, in bytes. */
|
|
263
|
+
audioMaxBytes?: number;
|
|
264
|
+
}
|
|
265
|
+
interface VideoToolConstraints {
|
|
266
|
+
kind: VideoToolKind;
|
|
267
|
+
/** Upscale: allowed factor range. */
|
|
268
|
+
upscaleFactor?: {
|
|
269
|
+
min: number;
|
|
270
|
+
max: number;
|
|
271
|
+
};
|
|
272
|
+
/** Upscale: the output's long edge may not pass this, in pixels. */
|
|
273
|
+
maxOutputLongEdge?: number;
|
|
274
|
+
/** Interpolate: allowed target frame rate range. */
|
|
275
|
+
fps?: {
|
|
276
|
+
min: number;
|
|
277
|
+
max: number;
|
|
278
|
+
};
|
|
279
|
+
/** HDR: the formats the row writes, first is the default. */
|
|
280
|
+
outputFormats?: VideoToolOutputFormat[];
|
|
193
281
|
}
|
|
194
282
|
/** Whether a video row's output has sound: always, switchable (`supports: generateAudio`), or silent. */
|
|
195
283
|
type AudioOutput = "always" | "optional" | "never";
|
|
@@ -232,7 +320,12 @@ interface ModelConstraints {
|
|
|
232
320
|
extension?: {
|
|
233
321
|
segmentSeconds: number;
|
|
234
322
|
maxTotalSeconds: number;
|
|
323
|
+
/** `joined` (absent): the provider returns the whole clip so far (Omni).
|
|
324
|
+
* `new`: it returns only the added footage and the caller joins it (Seedance). */
|
|
325
|
+
returns?: "new" | "joined";
|
|
235
326
|
};
|
|
327
|
+
/** What a `video-tool` row accepts. Read it through `videoToolConstraints(row)`. */
|
|
328
|
+
tool?: VideoToolConstraints;
|
|
236
329
|
/** Whether the output has sound. Read it through `outputAudio(row)`, which tolerates bad data. */
|
|
237
330
|
audio?: AudioOutput;
|
|
238
331
|
/** Prompt conventions. Read them through `promptConventions(row)`, which fills the default. */
|
|
@@ -293,6 +386,11 @@ interface CatalogDisplay {
|
|
|
293
386
|
interface CatalogCapabilities {
|
|
294
387
|
/** Video rows: takes an existing video as the thing to edit or extend. */
|
|
295
388
|
acceptsSourceVideo?: boolean;
|
|
389
|
+
/**
|
|
390
|
+
* Video rows: offered for prompt-driven edits of a source clip (`taskType: "edit"`). Absent
|
|
391
|
+
* means the caller falls back to `acceptsSourceVideo`; `false` opts a row out.
|
|
392
|
+
*/
|
|
393
|
+
videoEdit?: boolean;
|
|
296
394
|
/** Video rows: first/last frames and reference images are mutually exclusive inputs. */
|
|
297
395
|
framesExcludeReferences?: boolean;
|
|
298
396
|
/** Video rows: a last frame is accepted only together with a first frame. */
|
|
@@ -411,6 +509,8 @@ interface UsageEvent {
|
|
|
411
509
|
imageQuality?: ImageQuality;
|
|
412
510
|
resolution?: VideoResolution;
|
|
413
511
|
durationSeconds?: number;
|
|
512
|
+
/** Output frame rate (video-tool rows price by output frames). */
|
|
513
|
+
fps?: number;
|
|
414
514
|
inputTokens?: number;
|
|
415
515
|
outputTokens?: number;
|
|
416
516
|
reportedCostUsd?: number;
|
|
@@ -553,6 +653,7 @@ declare const CatalogModelSchemaBase: z.ZodObject<{
|
|
|
553
653
|
audio: "audio";
|
|
554
654
|
upscale: "upscale";
|
|
555
655
|
"bg-remove": "bg-remove";
|
|
656
|
+
"video-tool": "video-tool";
|
|
556
657
|
}>;
|
|
557
658
|
adapter: z.ZodEnum<{
|
|
558
659
|
"ai-sdk-text": "ai-sdk-text";
|
|
@@ -625,6 +726,13 @@ declare const CatalogModelSchemaBase: z.ZodObject<{
|
|
|
625
726
|
total: z.ZodOptional<z.ZodNumber>;
|
|
626
727
|
editMin: z.ZodOptional<z.ZodNumber>;
|
|
627
728
|
}, z.core.$loose>>;
|
|
729
|
+
audioSeconds: z.ZodOptional<z.ZodObject<{
|
|
730
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
731
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
732
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
733
|
+
}, z.core.$loose>>;
|
|
734
|
+
audioFormats: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
735
|
+
audioMaxBytes: z.ZodOptional<z.ZodNumber>;
|
|
628
736
|
}, z.core.$loose>>;
|
|
629
737
|
requires: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
630
738
|
references: "references";
|
|
@@ -664,6 +772,30 @@ declare const CatalogModelSchemaBase: z.ZodObject<{
|
|
|
664
772
|
extension: z.ZodOptional<z.ZodObject<{
|
|
665
773
|
segmentSeconds: z.ZodNumber;
|
|
666
774
|
maxTotalSeconds: z.ZodNumber;
|
|
775
|
+
returns: z.ZodOptional<z.ZodEnum<{
|
|
776
|
+
new: "new";
|
|
777
|
+
joined: "joined";
|
|
778
|
+
}>>;
|
|
779
|
+
}, z.core.$loose>>;
|
|
780
|
+
tool: z.ZodOptional<z.ZodObject<{
|
|
781
|
+
kind: z.ZodEnum<{
|
|
782
|
+
upscale: "upscale";
|
|
783
|
+
interpolate: "interpolate";
|
|
784
|
+
hdr: "hdr";
|
|
785
|
+
}>;
|
|
786
|
+
upscaleFactor: z.ZodOptional<z.ZodObject<{
|
|
787
|
+
min: z.ZodNumber;
|
|
788
|
+
max: z.ZodNumber;
|
|
789
|
+
}, z.core.$loose>>;
|
|
790
|
+
maxOutputLongEdge: z.ZodOptional<z.ZodNumber>;
|
|
791
|
+
fps: z.ZodOptional<z.ZodObject<{
|
|
792
|
+
min: z.ZodNumber;
|
|
793
|
+
max: z.ZodNumber;
|
|
794
|
+
}, z.core.$loose>>;
|
|
795
|
+
outputFormats: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
796
|
+
h265: "h265";
|
|
797
|
+
prores: "prores";
|
|
798
|
+
}>>>;
|
|
667
799
|
}, z.core.$loose>>;
|
|
668
800
|
audio: z.ZodOptional<z.ZodUnknown>;
|
|
669
801
|
prompt: z.ZodOptional<z.ZodUnknown>;
|
|
@@ -852,6 +984,7 @@ declare const CatalogModelSchemaBase: z.ZodObject<{
|
|
|
852
984
|
}, z.core.$loose>>;
|
|
853
985
|
capabilities: z.ZodOptional<z.ZodObject<{
|
|
854
986
|
acceptsSourceVideo: z.ZodOptional<z.ZodBoolean>;
|
|
987
|
+
videoEdit: z.ZodOptional<z.ZodBoolean>;
|
|
855
988
|
framesExcludeReferences: z.ZodOptional<z.ZodBoolean>;
|
|
856
989
|
lastFrameRequiresFirstFrame: z.ZodOptional<z.ZodBoolean>;
|
|
857
990
|
reasoning: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -919,6 +1052,29 @@ declare const IMAGE_MODELS: CatalogModel[];
|
|
|
919
1052
|
|
|
920
1053
|
declare const VIDEO_MODELS: CatalogModel[];
|
|
921
1054
|
|
|
1055
|
+
/**
|
|
1056
|
+
* Topaz Labs video tools on fal. `providerOptions.fal.model` names the Topaz model the
|
|
1057
|
+
* endpoint runs; the adapter sends it as `model`. Exposed on cowork only (Creative Studio).
|
|
1058
|
+
*/
|
|
1059
|
+
declare const VIDEO_TOOL_MODELS: CatalogModel[];
|
|
1060
|
+
|
|
1061
|
+
/** A video-tool row's constraints, or undefined when the row has none or they are invalid. */
|
|
1062
|
+
declare function videoToolConstraints(row: CatalogModel): VideoToolConstraints | undefined;
|
|
1063
|
+
/** The pricing tier a frame lands in, by its short edge. */
|
|
1064
|
+
declare function resolutionTier(width: number, height: number): VideoResolution;
|
|
1065
|
+
type VideoToolPlan = {
|
|
1066
|
+
ok: true;
|
|
1067
|
+
output: VideoToolOutputSpec;
|
|
1068
|
+
} | {
|
|
1069
|
+
ok: false;
|
|
1070
|
+
error: string;
|
|
1071
|
+
};
|
|
1072
|
+
/**
|
|
1073
|
+
* What a video-tool request produces, checked against the row. Pure: callers use it to
|
|
1074
|
+
* validate and price before submitting, and the adapter uses it to build the usage event.
|
|
1075
|
+
*/
|
|
1076
|
+
declare function planVideoTool(row: CatalogModel, req: Omit<VideoToolRequest, "model">): VideoToolPlan;
|
|
1077
|
+
|
|
922
1078
|
declare const TEXT_MODELS: CatalogModel[];
|
|
923
1079
|
|
|
924
1080
|
declare const OTHER_MODELS: CatalogModel[];
|
|
@@ -995,4 +1151,4 @@ declare function isModelKitError(err: unknown): err is ModelKitError;
|
|
|
995
1151
|
/** Resolve caller options against a catalog row, dispatching on `model.type`. */
|
|
996
1152
|
declare function resolveOptions(model: CatalogModel, request: ImageRequest | VideoRequest | AudioRequest, onUnsupported?: OnUnsupported): ResolveResult<ImageRequest | VideoRequest | AudioRequest>;
|
|
997
1153
|
|
|
998
|
-
export { ADAPTER_IDS, AUDIO_OUTPUTS, type AdapterEndpoints, type AdapterId, type AspectRatio, type AudioOutput, type AudioRequest, type AudioResult, type CallContext, Catalog, type CatalogAuth, type CatalogCache, type CatalogCapabilities, type CatalogDisplay, type CatalogEnvelope, type CatalogModel, CatalogModelSchema, CatalogModelSchemaBase, type CatalogOrigin, CatalogSchema, type CatalogSource, type Exposure, ExposureSchema, type GeneratedImage, IMAGE_MODELS, type ImageBytes, type ImageCallOptions, type ImageCallResult, type ImageQuality, type ImageRequest, type ImageResult, type ImageSafetySetting, type ImageSize, type JsonObject, type JsonPrimitive, type JsonValue, type KeyTier, type Lifecycle, type LiveCatalogState, MODELS, type MediaPart, type MediaRef, type ModelConstraints, type ModelKitConfig, ModelKitError, type ModelKitErrorCode, type ModelKitErrorInit, type ModelType, OTHER_MODELS, type OnUnsupported, type OutputFormat, type PricingKind, type PrimeCatalogResult, type PromptConventions, type ProviderErrorBody, type ProviderKeyName, type ProviderKeys, type ProviderOptionValue, type ProviderOptions, type QuarantineResult, REFERENCE_SYNTAXES, type ReferenceLimits, type ReferenceSyntax, type RequiredInput, type RequiredKeyName, type ResolveResult, type Routing, SURFACES, type SupportedOption, type Surface, SurfaceSchema, TEXT_MODELS, type UpscaleOptions, type UsageEvent, type UsageModality, type UsageUnit, VIDEO_MODELS, type VideoCallJob, type VideoCallOptions, type VideoJob, type VideoModel, type VideoRequest, type VideoResolution, type VideoResult, type VideoSecondsLimits, type Warning, billedAudio, compareCatalogOrder, hasAwsCredentials, isListed, isListedOn, isModelKitError, liveCatalog, liveState, nearestAspectRatio, normalizeExposure, outputAudio, primeCatalog, promptConventions, resetLiveCatalog, resolveAudioOptions, resolveImageOptions, resolveOptions, resolveVideoOptions, sortCatalogRows, videoLengthViolation };
|
|
1154
|
+
export { ADAPTER_IDS, AUDIO_OUTPUTS, type AdapterEndpoints, type AdapterId, type AspectRatio, type AudioOutput, type AudioRequest, type AudioResult, type CallContext, Catalog, type CatalogAuth, type CatalogCache, type CatalogCapabilities, type CatalogDisplay, type CatalogEnvelope, type CatalogModel, CatalogModelSchema, CatalogModelSchemaBase, type CatalogOrigin, CatalogSchema, type CatalogSource, type Exposure, ExposureSchema, type GeneratedImage, IMAGE_MODELS, type ImageBytes, type ImageCallOptions, type ImageCallResult, type ImageQuality, type ImageRequest, type ImageResult, type ImageSafetySetting, type ImageSize, type JsonObject, type JsonPrimitive, type JsonValue, type KeyTier, type Lifecycle, type LiveCatalogState, MODELS, type MediaPart, type MediaRef, type ModelConstraints, type ModelKitConfig, ModelKitError, type ModelKitErrorCode, type ModelKitErrorInit, type ModelType, OTHER_MODELS, type OnUnsupported, type OutputFormat, type PricingKind, type PrimeCatalogResult, type PromptConventions, type ProviderErrorBody, type ProviderKeyName, type ProviderKeys, type ProviderOptionValue, type ProviderOptions, type QuarantineResult, REFERENCE_SYNTAXES, type ReferenceLimits, type ReferenceSyntax, type RequiredInput, type RequiredKeyName, type ResolveResult, type Routing, SURFACES, type SupportedOption, type Surface, SurfaceSchema, TEXT_MODELS, type UpscaleOptions, type UsageEvent, type UsageModality, type UsageUnit, VIDEO_MODELS, VIDEO_TOOL_MODELS, type VideoCallJob, type VideoCallOptions, type VideoJob, type VideoModel, type VideoRequest, type VideoResolution, type VideoResult, type VideoSecondsLimits, type VideoToolCallContext, type VideoToolConstraints, type VideoToolKind, type VideoToolOutputFormat, type VideoToolOutputSpec, type VideoToolPlan, type VideoToolRequest, type VideoToolResult, type VideoToolSource, type VideoToolStatus, type VideoToolSubmission, type Warning, billedAudio, compareCatalogOrder, hasAwsCredentials, isListed, isListedOn, isModelKitError, liveCatalog, liveState, nearestAspectRatio, normalizeExposure, outputAudio, planVideoTool, primeCatalog, promptConventions, resetLiveCatalog, resolutionTier, resolveAudioOptions, resolveImageOptions, resolveOptions, resolveVideoOptions, sortCatalogRows, videoLengthViolation, videoToolConstraints };
|
package/dist/catalog.d.ts
CHANGED
|
@@ -39,7 +39,13 @@ interface UpscaleOptions {
|
|
|
39
39
|
faceEnhancementCreativity?: number;
|
|
40
40
|
faceEnhancementStrength?: number;
|
|
41
41
|
}
|
|
42
|
-
type ModelType = "text" | "image" | "video" | "audio" | "upscale" | "bg-remove"
|
|
42
|
+
type ModelType = "text" | "image" | "video" | "audio" | "upscale" | "bg-remove"
|
|
43
|
+
/** Video in, video out, no prompt: upscale, frame interpolation, SDR to HDR. */
|
|
44
|
+
| "video-tool";
|
|
45
|
+
/** What a `video-tool` row does to its source clip. */
|
|
46
|
+
type VideoToolKind = "upscale" | "interpolate" | "hdr";
|
|
47
|
+
/** Container/codec a video-tool row can write. */
|
|
48
|
+
type VideoToolOutputFormat = "h265" | "prores";
|
|
43
49
|
type Lifecycle = "active" | "deprecated" | "retired";
|
|
44
50
|
type Surface = "cowork" | "space_builder";
|
|
45
51
|
/** @deprecated use Surface[] */
|
|
@@ -130,6 +136,61 @@ interface VideoCallOptions extends Omit<VideoRequest, "model"> {
|
|
|
130
136
|
/** Reaches the provider only for AI SDK model instances; catalog rows carry their own. */
|
|
131
137
|
providerOptions?: ProviderOptions;
|
|
132
138
|
}
|
|
139
|
+
/** What the caller measured about a video-tool source; the kit never measures. */
|
|
140
|
+
interface VideoToolSource {
|
|
141
|
+
url: string;
|
|
142
|
+
width: number;
|
|
143
|
+
height: number;
|
|
144
|
+
durationSeconds: number;
|
|
145
|
+
fps?: number;
|
|
146
|
+
}
|
|
147
|
+
interface VideoToolRequest {
|
|
148
|
+
model: string;
|
|
149
|
+
source: VideoToolSource;
|
|
150
|
+
/** Upscale rows. */
|
|
151
|
+
upscaleFactor?: number;
|
|
152
|
+
/** Interpolate rows. */
|
|
153
|
+
targetFps?: number;
|
|
154
|
+
/** HDR rows; the row's first `outputFormats` entry when unset. */
|
|
155
|
+
outputFormat?: VideoToolOutputFormat;
|
|
156
|
+
}
|
|
157
|
+
/** The output a video-tool request will produce, from the request alone. */
|
|
158
|
+
interface VideoToolOutputSpec {
|
|
159
|
+
width: number;
|
|
160
|
+
height: number;
|
|
161
|
+
durationSeconds: number;
|
|
162
|
+
fps?: number;
|
|
163
|
+
resolution: VideoResolution;
|
|
164
|
+
format: "h264" | VideoToolOutputFormat;
|
|
165
|
+
}
|
|
166
|
+
interface VideoToolCallContext extends CallContext {
|
|
167
|
+
/** Where the provider posts the result when the job ends. */
|
|
168
|
+
webhookUrl?: string;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* A submitted video-tool job. Plain JSON so a caller can store it and pass it back
|
|
172
|
+
* to `videoToolStatus` / `videoToolResult` / `cancelVideoTool` from another process.
|
|
173
|
+
*/
|
|
174
|
+
interface VideoToolSubmission {
|
|
175
|
+
model: string;
|
|
176
|
+
provider: "fal";
|
|
177
|
+
requestId: string;
|
|
178
|
+
statusUrl: string;
|
|
179
|
+
responseUrl: string;
|
|
180
|
+
cancelUrl: string;
|
|
181
|
+
output: VideoToolOutputSpec;
|
|
182
|
+
}
|
|
183
|
+
type VideoToolStatus = "queued" | "running" | "completed";
|
|
184
|
+
interface VideoToolResult {
|
|
185
|
+
video: {
|
|
186
|
+
url: string;
|
|
187
|
+
mime?: string;
|
|
188
|
+
bytes?: number;
|
|
189
|
+
};
|
|
190
|
+
output: VideoToolOutputSpec;
|
|
191
|
+
usage: UsageEvent;
|
|
192
|
+
raw?: unknown;
|
|
193
|
+
}
|
|
133
194
|
interface AudioRequest {
|
|
134
195
|
model: string;
|
|
135
196
|
prompt: string;
|
|
@@ -190,6 +251,33 @@ interface ReferenceLimits {
|
|
|
190
251
|
audioOnly?: boolean;
|
|
191
252
|
/** Per-video length caps (min/max each) and combined total for reference videos. */
|
|
192
253
|
videoSeconds?: VideoSecondsLimits;
|
|
254
|
+
/** Per-clip length caps (min/max each) and combined total for reference audio, in seconds. */
|
|
255
|
+
audioSeconds?: {
|
|
256
|
+
min?: number;
|
|
257
|
+
max?: number;
|
|
258
|
+
total?: number;
|
|
259
|
+
};
|
|
260
|
+
/** File types the provider takes for reference audio, as lowercase extensions. */
|
|
261
|
+
audioFormats?: string[];
|
|
262
|
+
/** Largest reference audio file the provider takes, in bytes. */
|
|
263
|
+
audioMaxBytes?: number;
|
|
264
|
+
}
|
|
265
|
+
interface VideoToolConstraints {
|
|
266
|
+
kind: VideoToolKind;
|
|
267
|
+
/** Upscale: allowed factor range. */
|
|
268
|
+
upscaleFactor?: {
|
|
269
|
+
min: number;
|
|
270
|
+
max: number;
|
|
271
|
+
};
|
|
272
|
+
/** Upscale: the output's long edge may not pass this, in pixels. */
|
|
273
|
+
maxOutputLongEdge?: number;
|
|
274
|
+
/** Interpolate: allowed target frame rate range. */
|
|
275
|
+
fps?: {
|
|
276
|
+
min: number;
|
|
277
|
+
max: number;
|
|
278
|
+
};
|
|
279
|
+
/** HDR: the formats the row writes, first is the default. */
|
|
280
|
+
outputFormats?: VideoToolOutputFormat[];
|
|
193
281
|
}
|
|
194
282
|
/** Whether a video row's output has sound: always, switchable (`supports: generateAudio`), or silent. */
|
|
195
283
|
type AudioOutput = "always" | "optional" | "never";
|
|
@@ -232,7 +320,12 @@ interface ModelConstraints {
|
|
|
232
320
|
extension?: {
|
|
233
321
|
segmentSeconds: number;
|
|
234
322
|
maxTotalSeconds: number;
|
|
323
|
+
/** `joined` (absent): the provider returns the whole clip so far (Omni).
|
|
324
|
+
* `new`: it returns only the added footage and the caller joins it (Seedance). */
|
|
325
|
+
returns?: "new" | "joined";
|
|
235
326
|
};
|
|
327
|
+
/** What a `video-tool` row accepts. Read it through `videoToolConstraints(row)`. */
|
|
328
|
+
tool?: VideoToolConstraints;
|
|
236
329
|
/** Whether the output has sound. Read it through `outputAudio(row)`, which tolerates bad data. */
|
|
237
330
|
audio?: AudioOutput;
|
|
238
331
|
/** Prompt conventions. Read them through `promptConventions(row)`, which fills the default. */
|
|
@@ -293,6 +386,11 @@ interface CatalogDisplay {
|
|
|
293
386
|
interface CatalogCapabilities {
|
|
294
387
|
/** Video rows: takes an existing video as the thing to edit or extend. */
|
|
295
388
|
acceptsSourceVideo?: boolean;
|
|
389
|
+
/**
|
|
390
|
+
* Video rows: offered for prompt-driven edits of a source clip (`taskType: "edit"`). Absent
|
|
391
|
+
* means the caller falls back to `acceptsSourceVideo`; `false` opts a row out.
|
|
392
|
+
*/
|
|
393
|
+
videoEdit?: boolean;
|
|
296
394
|
/** Video rows: first/last frames and reference images are mutually exclusive inputs. */
|
|
297
395
|
framesExcludeReferences?: boolean;
|
|
298
396
|
/** Video rows: a last frame is accepted only together with a first frame. */
|
|
@@ -411,6 +509,8 @@ interface UsageEvent {
|
|
|
411
509
|
imageQuality?: ImageQuality;
|
|
412
510
|
resolution?: VideoResolution;
|
|
413
511
|
durationSeconds?: number;
|
|
512
|
+
/** Output frame rate (video-tool rows price by output frames). */
|
|
513
|
+
fps?: number;
|
|
414
514
|
inputTokens?: number;
|
|
415
515
|
outputTokens?: number;
|
|
416
516
|
reportedCostUsd?: number;
|
|
@@ -553,6 +653,7 @@ declare const CatalogModelSchemaBase: z.ZodObject<{
|
|
|
553
653
|
audio: "audio";
|
|
554
654
|
upscale: "upscale";
|
|
555
655
|
"bg-remove": "bg-remove";
|
|
656
|
+
"video-tool": "video-tool";
|
|
556
657
|
}>;
|
|
557
658
|
adapter: z.ZodEnum<{
|
|
558
659
|
"ai-sdk-text": "ai-sdk-text";
|
|
@@ -625,6 +726,13 @@ declare const CatalogModelSchemaBase: z.ZodObject<{
|
|
|
625
726
|
total: z.ZodOptional<z.ZodNumber>;
|
|
626
727
|
editMin: z.ZodOptional<z.ZodNumber>;
|
|
627
728
|
}, z.core.$loose>>;
|
|
729
|
+
audioSeconds: z.ZodOptional<z.ZodObject<{
|
|
730
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
731
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
732
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
733
|
+
}, z.core.$loose>>;
|
|
734
|
+
audioFormats: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
735
|
+
audioMaxBytes: z.ZodOptional<z.ZodNumber>;
|
|
628
736
|
}, z.core.$loose>>;
|
|
629
737
|
requires: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
630
738
|
references: "references";
|
|
@@ -664,6 +772,30 @@ declare const CatalogModelSchemaBase: z.ZodObject<{
|
|
|
664
772
|
extension: z.ZodOptional<z.ZodObject<{
|
|
665
773
|
segmentSeconds: z.ZodNumber;
|
|
666
774
|
maxTotalSeconds: z.ZodNumber;
|
|
775
|
+
returns: z.ZodOptional<z.ZodEnum<{
|
|
776
|
+
new: "new";
|
|
777
|
+
joined: "joined";
|
|
778
|
+
}>>;
|
|
779
|
+
}, z.core.$loose>>;
|
|
780
|
+
tool: z.ZodOptional<z.ZodObject<{
|
|
781
|
+
kind: z.ZodEnum<{
|
|
782
|
+
upscale: "upscale";
|
|
783
|
+
interpolate: "interpolate";
|
|
784
|
+
hdr: "hdr";
|
|
785
|
+
}>;
|
|
786
|
+
upscaleFactor: z.ZodOptional<z.ZodObject<{
|
|
787
|
+
min: z.ZodNumber;
|
|
788
|
+
max: z.ZodNumber;
|
|
789
|
+
}, z.core.$loose>>;
|
|
790
|
+
maxOutputLongEdge: z.ZodOptional<z.ZodNumber>;
|
|
791
|
+
fps: z.ZodOptional<z.ZodObject<{
|
|
792
|
+
min: z.ZodNumber;
|
|
793
|
+
max: z.ZodNumber;
|
|
794
|
+
}, z.core.$loose>>;
|
|
795
|
+
outputFormats: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
796
|
+
h265: "h265";
|
|
797
|
+
prores: "prores";
|
|
798
|
+
}>>>;
|
|
667
799
|
}, z.core.$loose>>;
|
|
668
800
|
audio: z.ZodOptional<z.ZodUnknown>;
|
|
669
801
|
prompt: z.ZodOptional<z.ZodUnknown>;
|
|
@@ -852,6 +984,7 @@ declare const CatalogModelSchemaBase: z.ZodObject<{
|
|
|
852
984
|
}, z.core.$loose>>;
|
|
853
985
|
capabilities: z.ZodOptional<z.ZodObject<{
|
|
854
986
|
acceptsSourceVideo: z.ZodOptional<z.ZodBoolean>;
|
|
987
|
+
videoEdit: z.ZodOptional<z.ZodBoolean>;
|
|
855
988
|
framesExcludeReferences: z.ZodOptional<z.ZodBoolean>;
|
|
856
989
|
lastFrameRequiresFirstFrame: z.ZodOptional<z.ZodBoolean>;
|
|
857
990
|
reasoning: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -919,6 +1052,29 @@ declare const IMAGE_MODELS: CatalogModel[];
|
|
|
919
1052
|
|
|
920
1053
|
declare const VIDEO_MODELS: CatalogModel[];
|
|
921
1054
|
|
|
1055
|
+
/**
|
|
1056
|
+
* Topaz Labs video tools on fal. `providerOptions.fal.model` names the Topaz model the
|
|
1057
|
+
* endpoint runs; the adapter sends it as `model`. Exposed on cowork only (Creative Studio).
|
|
1058
|
+
*/
|
|
1059
|
+
declare const VIDEO_TOOL_MODELS: CatalogModel[];
|
|
1060
|
+
|
|
1061
|
+
/** A video-tool row's constraints, or undefined when the row has none or they are invalid. */
|
|
1062
|
+
declare function videoToolConstraints(row: CatalogModel): VideoToolConstraints | undefined;
|
|
1063
|
+
/** The pricing tier a frame lands in, by its short edge. */
|
|
1064
|
+
declare function resolutionTier(width: number, height: number): VideoResolution;
|
|
1065
|
+
type VideoToolPlan = {
|
|
1066
|
+
ok: true;
|
|
1067
|
+
output: VideoToolOutputSpec;
|
|
1068
|
+
} | {
|
|
1069
|
+
ok: false;
|
|
1070
|
+
error: string;
|
|
1071
|
+
};
|
|
1072
|
+
/**
|
|
1073
|
+
* What a video-tool request produces, checked against the row. Pure: callers use it to
|
|
1074
|
+
* validate and price before submitting, and the adapter uses it to build the usage event.
|
|
1075
|
+
*/
|
|
1076
|
+
declare function planVideoTool(row: CatalogModel, req: Omit<VideoToolRequest, "model">): VideoToolPlan;
|
|
1077
|
+
|
|
922
1078
|
declare const TEXT_MODELS: CatalogModel[];
|
|
923
1079
|
|
|
924
1080
|
declare const OTHER_MODELS: CatalogModel[];
|
|
@@ -995,4 +1151,4 @@ declare function isModelKitError(err: unknown): err is ModelKitError;
|
|
|
995
1151
|
/** Resolve caller options against a catalog row, dispatching on `model.type`. */
|
|
996
1152
|
declare function resolveOptions(model: CatalogModel, request: ImageRequest | VideoRequest | AudioRequest, onUnsupported?: OnUnsupported): ResolveResult<ImageRequest | VideoRequest | AudioRequest>;
|
|
997
1153
|
|
|
998
|
-
export { ADAPTER_IDS, AUDIO_OUTPUTS, type AdapterEndpoints, type AdapterId, type AspectRatio, type AudioOutput, type AudioRequest, type AudioResult, type CallContext, Catalog, type CatalogAuth, type CatalogCache, type CatalogCapabilities, type CatalogDisplay, type CatalogEnvelope, type CatalogModel, CatalogModelSchema, CatalogModelSchemaBase, type CatalogOrigin, CatalogSchema, type CatalogSource, type Exposure, ExposureSchema, type GeneratedImage, IMAGE_MODELS, type ImageBytes, type ImageCallOptions, type ImageCallResult, type ImageQuality, type ImageRequest, type ImageResult, type ImageSafetySetting, type ImageSize, type JsonObject, type JsonPrimitive, type JsonValue, type KeyTier, type Lifecycle, type LiveCatalogState, MODELS, type MediaPart, type MediaRef, type ModelConstraints, type ModelKitConfig, ModelKitError, type ModelKitErrorCode, type ModelKitErrorInit, type ModelType, OTHER_MODELS, type OnUnsupported, type OutputFormat, type PricingKind, type PrimeCatalogResult, type PromptConventions, type ProviderErrorBody, type ProviderKeyName, type ProviderKeys, type ProviderOptionValue, type ProviderOptions, type QuarantineResult, REFERENCE_SYNTAXES, type ReferenceLimits, type ReferenceSyntax, type RequiredInput, type RequiredKeyName, type ResolveResult, type Routing, SURFACES, type SupportedOption, type Surface, SurfaceSchema, TEXT_MODELS, type UpscaleOptions, type UsageEvent, type UsageModality, type UsageUnit, VIDEO_MODELS, type VideoCallJob, type VideoCallOptions, type VideoJob, type VideoModel, type VideoRequest, type VideoResolution, type VideoResult, type VideoSecondsLimits, type Warning, billedAudio, compareCatalogOrder, hasAwsCredentials, isListed, isListedOn, isModelKitError, liveCatalog, liveState, nearestAspectRatio, normalizeExposure, outputAudio, primeCatalog, promptConventions, resetLiveCatalog, resolveAudioOptions, resolveImageOptions, resolveOptions, resolveVideoOptions, sortCatalogRows, videoLengthViolation };
|
|
1154
|
+
export { ADAPTER_IDS, AUDIO_OUTPUTS, type AdapterEndpoints, type AdapterId, type AspectRatio, type AudioOutput, type AudioRequest, type AudioResult, type CallContext, Catalog, type CatalogAuth, type CatalogCache, type CatalogCapabilities, type CatalogDisplay, type CatalogEnvelope, type CatalogModel, CatalogModelSchema, CatalogModelSchemaBase, type CatalogOrigin, CatalogSchema, type CatalogSource, type Exposure, ExposureSchema, type GeneratedImage, IMAGE_MODELS, type ImageBytes, type ImageCallOptions, type ImageCallResult, type ImageQuality, type ImageRequest, type ImageResult, type ImageSafetySetting, type ImageSize, type JsonObject, type JsonPrimitive, type JsonValue, type KeyTier, type Lifecycle, type LiveCatalogState, MODELS, type MediaPart, type MediaRef, type ModelConstraints, type ModelKitConfig, ModelKitError, type ModelKitErrorCode, type ModelKitErrorInit, type ModelType, OTHER_MODELS, type OnUnsupported, type OutputFormat, type PricingKind, type PrimeCatalogResult, type PromptConventions, type ProviderErrorBody, type ProviderKeyName, type ProviderKeys, type ProviderOptionValue, type ProviderOptions, type QuarantineResult, REFERENCE_SYNTAXES, type ReferenceLimits, type ReferenceSyntax, type RequiredInput, type RequiredKeyName, type ResolveResult, type Routing, SURFACES, type SupportedOption, type Surface, SurfaceSchema, TEXT_MODELS, type UpscaleOptions, type UsageEvent, type UsageModality, type UsageUnit, VIDEO_MODELS, VIDEO_TOOL_MODELS, type VideoCallJob, type VideoCallOptions, type VideoJob, type VideoModel, type VideoRequest, type VideoResolution, type VideoResult, type VideoSecondsLimits, type VideoToolCallContext, type VideoToolConstraints, type VideoToolKind, type VideoToolOutputFormat, type VideoToolOutputSpec, type VideoToolPlan, type VideoToolRequest, type VideoToolResult, type VideoToolSource, type VideoToolStatus, type VideoToolSubmission, type Warning, billedAudio, compareCatalogOrder, hasAwsCredentials, isListed, isListedOn, isModelKitError, liveCatalog, liveState, nearestAspectRatio, normalizeExposure, outputAudio, planVideoTool, primeCatalog, promptConventions, resetLiveCatalog, resolutionTier, resolveAudioOptions, resolveImageOptions, resolveOptions, resolveVideoOptions, sortCatalogRows, videoLengthViolation, videoToolConstraints };
|