@ai-sdk/topaz 2.0.0 → 3.0.1
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 +18 -2
- package/dist/index.d.ts +183 -180
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1100 -1294
- package/dist/index.js.map +1 -1
- package/docs/210-topaz.mdx +17 -6
- package/package.json +11 -11
- package/src/topaz-image-model.ts +34 -16
- package/src/topaz-provider.ts +11 -11
- package/src/topaz-video-model-options.ts +0 -6
- package/src/topaz-video-model.ts +61 -105
- package/src/topaz-get-from-api.ts +0 -53
package/CHANGELOG.md
CHANGED
|
@@ -1,7 +1,23 @@
|
|
|
1
1
|
# @ai-sdk/topaz
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 3.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [2959d35]
|
|
8
|
+
- Updated dependencies [59116e6]
|
|
9
|
+
- @ai-sdk/provider@4.0.22
|
|
10
|
+
- @ai-sdk/provider-utils@5.0.54
|
|
11
|
+
|
|
12
|
+
## 3.0.0
|
|
4
13
|
|
|
5
14
|
### Major Changes
|
|
6
15
|
|
|
7
|
-
-
|
|
16
|
+
- 09aa6c2: feat (provider/topaz): add Topaz Labs provider
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- Updated dependencies [8c65988]
|
|
21
|
+
- Updated dependencies [527a163]
|
|
22
|
+
- @ai-sdk/provider@4.0.21
|
|
23
|
+
- @ai-sdk/provider-utils@5.0.53
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { Experimental_VideoModelV4, ImageModelV4, ProviderV4 } from "@ai-sdk/provider";
|
|
2
|
+
import { FetchFunction, InferSchema } from "@ai-sdk/provider-utils";
|
|
3
|
+
import { z } from "zod/v4";
|
|
4
|
+
//#region src/topaz-image-settings.d.ts
|
|
6
5
|
/**
|
|
7
6
|
* Topaz image model ids.
|
|
8
7
|
*
|
|
@@ -12,7 +11,8 @@ import { z } from 'zod/v4';
|
|
|
12
11
|
* to the API unchanged.
|
|
13
12
|
*/
|
|
14
13
|
type TopazImageModelId = 'wonder-3.5' | (string & {});
|
|
15
|
-
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/topaz-video-settings.d.ts
|
|
16
16
|
/**
|
|
17
17
|
* Topaz video model ids.
|
|
18
18
|
*
|
|
@@ -22,56 +22,58 @@ type TopazImageModelId = 'wonder-3.5' | (string & {});
|
|
|
22
22
|
* works - unknown ids are forwarded to the API unchanged.
|
|
23
23
|
*/
|
|
24
24
|
type TopazVideoModelId = 'proteus' | 'starlight-precise-2.6' | (string & {});
|
|
25
|
-
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region src/topaz-provider.d.ts
|
|
26
27
|
interface TopazProviderSettings {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
28
|
+
/**
|
|
29
|
+
* Topaz Labs API key. Default value is taken from the `TOPAZ_API_KEY`
|
|
30
|
+
* environment variable.
|
|
31
|
+
*
|
|
32
|
+
* @see https://developer.topazlabs.com/getting-started/api-key-setup
|
|
33
|
+
*/
|
|
34
|
+
apiKey?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Base URL for the API calls.
|
|
37
|
+
*/
|
|
38
|
+
baseURL?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Custom headers to include in the requests.
|
|
41
|
+
*/
|
|
42
|
+
headers?: Record<string, string>;
|
|
43
|
+
/**
|
|
44
|
+
* Custom fetch implementation. You can use it as a middleware to intercept
|
|
45
|
+
* requests, or to provide a custom fetch implementation for e.g. testing.
|
|
46
|
+
*/
|
|
47
|
+
fetch?: FetchFunction;
|
|
47
48
|
}
|
|
48
|
-
interface TopazProvider extends
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
49
|
+
interface TopazProvider extends ProviderV4 {
|
|
50
|
+
/**
|
|
51
|
+
* Creates a model for image enhancement.
|
|
52
|
+
*/
|
|
53
|
+
image(modelId: TopazImageModelId): ImageModelV4;
|
|
54
|
+
/**
|
|
55
|
+
* Creates a model for image enhancement.
|
|
56
|
+
*/
|
|
57
|
+
imageModel(modelId: TopazImageModelId): ImageModelV4;
|
|
58
|
+
/**
|
|
59
|
+
* Creates a model for video enhancement.
|
|
60
|
+
*/
|
|
61
|
+
video(modelId: TopazVideoModelId): Experimental_VideoModelV4;
|
|
62
|
+
/**
|
|
63
|
+
* Creates a model for video enhancement.
|
|
64
|
+
*/
|
|
65
|
+
videoModel(modelId: TopazVideoModelId): Experimental_VideoModelV4;
|
|
65
66
|
}
|
|
66
67
|
/**
|
|
67
68
|
* Create a Topaz Labs provider instance.
|
|
68
69
|
*/
|
|
69
|
-
declare function createTopaz(options?: TopazProviderSettings): TopazProvider;
|
|
70
|
+
export declare function createTopaz(options?: TopazProviderSettings): TopazProvider;
|
|
70
71
|
/**
|
|
71
72
|
* Default Topaz Labs provider instance.
|
|
72
73
|
*/
|
|
73
|
-
declare const topaz: TopazProvider;
|
|
74
|
-
|
|
74
|
+
export declare const topaz: TopazProvider;
|
|
75
|
+
//#endregion
|
|
76
|
+
//#region src/topaz-image-model-options.d.ts
|
|
75
77
|
/**
|
|
76
78
|
* Provider options for Topaz generative image models (Wonder 3.5).
|
|
77
79
|
*
|
|
@@ -81,25 +83,26 @@ declare const topaz: TopazProvider;
|
|
|
81
83
|
*
|
|
82
84
|
* @see https://developer.topazlabs.com/image-models/wonder/wonder-3.5-new
|
|
83
85
|
*/
|
|
84
|
-
declare const topazImageModelOptionsSchema:
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
86
|
+
declare const topazImageModelOptionsSchema: import("@ai-sdk/provider-utils").LazySchema<{
|
|
87
|
+
enhancementStrength?: "low" | "medium" | "high" | undefined;
|
|
88
|
+
grain?: boolean | undefined;
|
|
89
|
+
grainDensity?: number | undefined;
|
|
90
|
+
grainModel?: "silver" | "gaussian" | "grey" | undefined;
|
|
91
|
+
grainSize?: number | undefined;
|
|
92
|
+
grainStrength?: number | undefined;
|
|
93
|
+
inputWidth?: number | undefined;
|
|
94
|
+
inputHeight?: number | undefined;
|
|
95
|
+
outputWidth?: number | undefined;
|
|
96
|
+
outputHeight?: number | undefined;
|
|
97
|
+
outputFormat?: "jpeg" | "jpg" | "png" | "tiff" | "tif" | undefined;
|
|
98
|
+
cropToFill?: boolean | undefined;
|
|
99
|
+
webhookUrl?: string | undefined;
|
|
100
|
+
pollIntervalMillis?: number | undefined;
|
|
101
|
+
pollTimeoutMillis?: number | undefined;
|
|
100
102
|
}>;
|
|
101
103
|
type TopazImageModelOptions = InferSchema<typeof topazImageModelOptionsSchema>;
|
|
102
|
-
|
|
104
|
+
//#endregion
|
|
105
|
+
//#region src/topaz-video-model-options.d.ts
|
|
103
106
|
/**
|
|
104
107
|
* Metadata about the input video.
|
|
105
108
|
*
|
|
@@ -110,76 +113,76 @@ type TopazImageModelOptions = InferSchema<typeof topazImageModelOptionsSchema>;
|
|
|
110
113
|
* requires all four.
|
|
111
114
|
*/
|
|
112
115
|
declare const topazVideoSourceSchema: z.ZodObject<{
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
116
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
117
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
118
|
+
duration: z.ZodOptional<z.ZodNumber>;
|
|
119
|
+
frameRate: z.ZodOptional<z.ZodNumber>;
|
|
120
|
+
frameCount: z.ZodOptional<z.ZodNumber>;
|
|
121
|
+
container: z.ZodOptional<z.ZodEnum<{
|
|
122
|
+
"3gp": "3gp";
|
|
123
|
+
avi: "avi";
|
|
124
|
+
dv: "dv";
|
|
125
|
+
flv: "flv";
|
|
126
|
+
m1v: "m1v";
|
|
127
|
+
m2t: "m2t";
|
|
128
|
+
m2ts: "m2ts";
|
|
129
|
+
m2v: "m2v";
|
|
130
|
+
m4v: "m4v";
|
|
131
|
+
mkv: "mkv";
|
|
132
|
+
mov: "mov";
|
|
133
|
+
mp4: "mp4";
|
|
134
|
+
mpeg: "mpeg";
|
|
135
|
+
mpg: "mpg";
|
|
136
|
+
mts: "mts";
|
|
137
|
+
mxf: "mxf";
|
|
138
|
+
ser: "ser";
|
|
139
|
+
ts: "ts";
|
|
140
|
+
vob: "vob";
|
|
141
|
+
webm: "webm";
|
|
142
|
+
wmv: "wmv";
|
|
143
|
+
}>>;
|
|
141
144
|
}, z.core.$strip>;
|
|
142
145
|
type TopazVideoSource = z.infer<typeof topazVideoSourceSchema>;
|
|
143
146
|
/**
|
|
144
147
|
* Output settings for the enhanced video.
|
|
145
148
|
*/
|
|
146
149
|
declare const topazVideoOutputSchema: z.ZodObject<{
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
150
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
151
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
152
|
+
frameRate: z.ZodOptional<z.ZodNumber>;
|
|
153
|
+
audioCodec: z.ZodOptional<z.ZodEnum<{
|
|
154
|
+
AAC: "AAC";
|
|
155
|
+
AC3: "AC3";
|
|
156
|
+
PCM: "PCM";
|
|
157
|
+
}>>;
|
|
158
|
+
audioBitrate: z.ZodOptional<z.ZodString>;
|
|
159
|
+
audioTransfer: z.ZodOptional<z.ZodEnum<{
|
|
160
|
+
Copy: "Copy";
|
|
161
|
+
Convert: "Convert";
|
|
162
|
+
None: "None";
|
|
163
|
+
}>>;
|
|
164
|
+
videoEncoder: z.ZodOptional<z.ZodEnum<{
|
|
165
|
+
AV1: "AV1";
|
|
166
|
+
H264: "H264";
|
|
167
|
+
H265: "H265";
|
|
168
|
+
ProRes: "ProRes";
|
|
169
|
+
VP9: "VP9";
|
|
170
|
+
}>>;
|
|
171
|
+
videoProfile: z.ZodOptional<z.ZodString>;
|
|
172
|
+
videoBitrate: z.ZodOptional<z.ZodString>;
|
|
173
|
+
dynamicCompressionLevel: z.ZodOptional<z.ZodEnum<{
|
|
174
|
+
Low: "Low";
|
|
175
|
+
Mid: "Mid";
|
|
176
|
+
High: "High";
|
|
177
|
+
}>>;
|
|
178
|
+
cropToFit: z.ZodOptional<z.ZodBoolean>;
|
|
179
|
+
container: z.ZodOptional<z.ZodEnum<{
|
|
180
|
+
avi: "avi";
|
|
181
|
+
mkv: "mkv";
|
|
182
|
+
mov: "mov";
|
|
183
|
+
mp4: "mp4";
|
|
184
|
+
webm: "webm";
|
|
185
|
+
}>>;
|
|
183
186
|
}, z.core.$strip>;
|
|
184
187
|
type TopazVideoOutput = z.infer<typeof topazVideoOutputSchema>;
|
|
185
188
|
/**
|
|
@@ -188,57 +191,57 @@ type TopazVideoOutput = z.infer<typeof topazVideoOutputSchema>;
|
|
|
188
191
|
* @see https://developer.topazlabs.com/video-models/proteus/proteus-1
|
|
189
192
|
* @see https://developer.topazlabs.com/video-models/starlight/starlight-precise-2.6
|
|
190
193
|
*/
|
|
191
|
-
declare const topazVideoModelOptionsSchema:
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
videoProfile?: "420" | "422" | "444" | undefined;
|
|
238
|
-
watermark?: boolean | undefined;
|
|
194
|
+
declare const topazVideoModelOptionsSchema: import("@ai-sdk/provider-utils").LazySchema<{
|
|
195
|
+
source?: {
|
|
196
|
+
width?: number | undefined;
|
|
197
|
+
height?: number | undefined;
|
|
198
|
+
duration?: number | undefined;
|
|
199
|
+
frameRate?: number | undefined;
|
|
200
|
+
frameCount?: number | undefined;
|
|
201
|
+
container?: "3gp" | "avi" | "dv" | "flv" | "m1v" | "m2t" | "m2ts" | "m2v" | "m4v" | "mkv" | "mov" | "mp4" | "mpeg" | "mpg" | "mts" | "mxf" | "ser" | "ts" | "vob" | "webm" | "wmv" | undefined;
|
|
202
|
+
} | undefined;
|
|
203
|
+
output?: {
|
|
204
|
+
width?: number | undefined;
|
|
205
|
+
height?: number | undefined;
|
|
206
|
+
frameRate?: number | undefined;
|
|
207
|
+
audioCodec?: "AAC" | "AC3" | "PCM" | undefined;
|
|
208
|
+
audioBitrate?: string | undefined;
|
|
209
|
+
audioTransfer?: "Copy" | "Convert" | "None" | undefined;
|
|
210
|
+
videoEncoder?: "AV1" | "H264" | "H265" | "ProRes" | "VP9" | undefined;
|
|
211
|
+
videoProfile?: string | undefined;
|
|
212
|
+
videoBitrate?: string | undefined;
|
|
213
|
+
dynamicCompressionLevel?: "Low" | "Mid" | "High" | undefined;
|
|
214
|
+
cropToFit?: boolean | undefined;
|
|
215
|
+
container?: "avi" | "mkv" | "mov" | "mp4" | "webm" | undefined;
|
|
216
|
+
} | undefined;
|
|
217
|
+
additionalFilters?: Record<string, unknown>[] | undefined;
|
|
218
|
+
filter?: Record<string, unknown> | undefined;
|
|
219
|
+
videoType?: "Progressive" | "Interlaced" | "ProgressiveInterlaced" | undefined;
|
|
220
|
+
auto?: "Auto" | "Manual" | "Relative" | undefined;
|
|
221
|
+
fieldOrder?: "Auto" | "TopFirst" | "BottomFirst" | undefined;
|
|
222
|
+
focusFixLevel?: "None" | "Normal" | "Strong" | undefined;
|
|
223
|
+
compression?: number | undefined;
|
|
224
|
+
details?: number | undefined;
|
|
225
|
+
prenoise?: number | undefined;
|
|
226
|
+
noise?: number | undefined;
|
|
227
|
+
halo?: number | undefined;
|
|
228
|
+
preblur?: number | undefined;
|
|
229
|
+
blur?: number | undefined;
|
|
230
|
+
grain?: number | undefined;
|
|
231
|
+
grainSigma?: number | undefined;
|
|
232
|
+
grainSize?: number | undefined;
|
|
233
|
+
grainType?: "gaussian" | "grey" | "silver_rich" | undefined;
|
|
234
|
+
recoverOriginalDetailValue?: number | undefined;
|
|
235
|
+
sharpness?: number | undefined;
|
|
236
|
+
videoBitDepth?: number | undefined;
|
|
237
|
+
videoCodec?: "ffv1" | "prores" | "vp9" | undefined;
|
|
238
|
+
videoProfile?: "420" | "422" | "444" | undefined;
|
|
239
|
+
watermark?: boolean | undefined;
|
|
239
240
|
}>;
|
|
240
241
|
type TopazVideoModelOptions = InferSchema<typeof topazVideoModelOptionsSchema>;
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
242
|
+
//#endregion
|
|
243
|
+
//#region src/version.d.ts
|
|
244
|
+
export declare const VERSION: string;
|
|
245
|
+
//#endregion
|
|
246
|
+
export type { TopazImageModelId, TopazImageModelOptions, TopazProvider, TopazProviderSettings, TopazVideoModelId, TopazVideoModelOptions, TopazVideoOutput, TopazVideoSource };
|
|
247
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":["VideoModelV4"],"sources":["../src/topaz-image-settings.ts","../src/topaz-video-settings.ts","../src/topaz-provider.ts","../src/topaz-image-model-options.ts","../src/topaz-video-model-options.ts","../src/version.ts"],"mappings":";;;;;;;;;;;;KAQY;;;;;;;;;;;KCAA;;;UCUK;;;;;;;EAOf;;;;EAKA;;;;EAKA,UAAU;;;;;EAMV,QAAQ;;UAGO,sBAAsB;;;;EAIrC,MAAM,SAAS,oBAAoB;;;;EAKnC,WAAW,SAAS,oBAAoB;;;;EAKxC,MAAM,SAAS,oBAAoBA;;;;EAKnC,WAAW,SAAS,oBAAoBA;;;;;wBAQ1B,YACd,UAAS,wBACR;;;;qBA8DU,OAAK;;;;;;;;;;;;cCvHL,+DAA4B;;;;;;;;;;;;;;;;;KAwF7B,yBAAyB,mBAC5B;;;;;;;;;;;;cCnDI,wBAAsB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCjC,EAAA,KAAA;KAEU,mBAAmB,EAAE,aAAa;;;;cAKjC,wBAAsB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqEjC,EAAA,KAAA;KAEU,mBAAmB,EAAE,aAAa;;;;;;;cAQjC,+DAA4B;;;;;;;;;;;;;;;;;;;;;;;sBAA5B;WAAA;;;;;;;;;;;;;;;;;;;;;;;KA+FD,yBAAyB,mBAC5B;;;qBC5QI"}
|