@ai-sdk/xai 3.0.107 → 3.0.109
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 +13 -0
- package/dist/index.d.mts +11 -5
- package/dist/index.d.ts +11 -5
- package/dist/index.js +13 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -2
- package/dist/index.mjs.map +1 -1
- package/docs/01-xai.mdx +9 -0
- package/package.json +4 -4
- package/src/xai-video-model.ts +5 -0
- package/src/xai-video-options.ts +25 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @ai-sdk/xai
|
|
2
2
|
|
|
3
|
+
## 3.0.109
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- b0db900: feat(provider/xai): support end-user identifiers for video generation and editing
|
|
8
|
+
|
|
9
|
+
## 3.0.108
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies [94fda5c]
|
|
14
|
+
- @ai-sdk/openai-compatible@2.0.61
|
|
15
|
+
|
|
3
16
|
## 3.0.107
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -122,7 +122,13 @@ interface XaiVideoSharedOptions {
|
|
|
122
122
|
pollTimeoutMs?: number | null;
|
|
123
123
|
resolution?: XaiVideoResolution | null;
|
|
124
124
|
}
|
|
125
|
-
interface
|
|
125
|
+
interface XaiVideoUserOptions {
|
|
126
|
+
/**
|
|
127
|
+
* A unique identifier representing the end user, for abuse monitoring.
|
|
128
|
+
*/
|
|
129
|
+
user?: string;
|
|
130
|
+
}
|
|
131
|
+
interface XaiVideoEditModeOptions extends XaiVideoSharedOptions, XaiVideoUserOptions {
|
|
126
132
|
/**
|
|
127
133
|
* Select edit-video mode explicitly for best autocomplete and narrowing.
|
|
128
134
|
*/
|
|
@@ -138,7 +144,7 @@ interface XaiVideoExtendModeOptions extends XaiVideoSharedOptions {
|
|
|
138
144
|
/** Source video URL to extend from its last frame. */
|
|
139
145
|
videoUrl: string;
|
|
140
146
|
}
|
|
141
|
-
interface XaiVideoReferenceToVideoOptions extends XaiVideoSharedOptions {
|
|
147
|
+
interface XaiVideoReferenceToVideoOptions extends XaiVideoSharedOptions, XaiVideoUserOptions {
|
|
142
148
|
/**
|
|
143
149
|
* Select reference-to-video mode explicitly for best autocomplete and narrowing.
|
|
144
150
|
*/
|
|
@@ -146,12 +152,12 @@ interface XaiVideoReferenceToVideoOptions extends XaiVideoSharedOptions {
|
|
|
146
152
|
/** Reference image URLs (1-7) for R2V generation. */
|
|
147
153
|
referenceImageUrls: string[];
|
|
148
154
|
}
|
|
149
|
-
interface XaiVideoGenerationOptions extends XaiVideoSharedOptions {
|
|
155
|
+
interface XaiVideoGenerationOptions extends XaiVideoSharedOptions, XaiVideoUserOptions {
|
|
150
156
|
mode?: undefined;
|
|
151
157
|
videoUrl?: undefined;
|
|
152
158
|
referenceImageUrls?: undefined;
|
|
153
159
|
}
|
|
154
|
-
interface XaiLegacyEditVideoOptions extends XaiVideoSharedOptions {
|
|
160
|
+
interface XaiLegacyEditVideoOptions extends XaiVideoSharedOptions, XaiVideoUserOptions {
|
|
155
161
|
/**
|
|
156
162
|
* Legacy backward-compatible shape: omitting `mode` while providing
|
|
157
163
|
* `videoUrl` behaves like edit-video.
|
|
@@ -159,7 +165,7 @@ interface XaiLegacyEditVideoOptions extends XaiVideoSharedOptions {
|
|
|
159
165
|
mode?: undefined;
|
|
160
166
|
videoUrl: string;
|
|
161
167
|
}
|
|
162
|
-
interface XaiLegacyReferenceToVideoOptions extends XaiVideoSharedOptions {
|
|
168
|
+
interface XaiLegacyReferenceToVideoOptions extends XaiVideoSharedOptions, XaiVideoUserOptions {
|
|
163
169
|
/**
|
|
164
170
|
* Legacy backward-compatible shape: omitting `mode` while providing
|
|
165
171
|
* `referenceImageUrls` behaves like reference-to-video.
|
package/dist/index.d.ts
CHANGED
|
@@ -122,7 +122,13 @@ interface XaiVideoSharedOptions {
|
|
|
122
122
|
pollTimeoutMs?: number | null;
|
|
123
123
|
resolution?: XaiVideoResolution | null;
|
|
124
124
|
}
|
|
125
|
-
interface
|
|
125
|
+
interface XaiVideoUserOptions {
|
|
126
|
+
/**
|
|
127
|
+
* A unique identifier representing the end user, for abuse monitoring.
|
|
128
|
+
*/
|
|
129
|
+
user?: string;
|
|
130
|
+
}
|
|
131
|
+
interface XaiVideoEditModeOptions extends XaiVideoSharedOptions, XaiVideoUserOptions {
|
|
126
132
|
/**
|
|
127
133
|
* Select edit-video mode explicitly for best autocomplete and narrowing.
|
|
128
134
|
*/
|
|
@@ -138,7 +144,7 @@ interface XaiVideoExtendModeOptions extends XaiVideoSharedOptions {
|
|
|
138
144
|
/** Source video URL to extend from its last frame. */
|
|
139
145
|
videoUrl: string;
|
|
140
146
|
}
|
|
141
|
-
interface XaiVideoReferenceToVideoOptions extends XaiVideoSharedOptions {
|
|
147
|
+
interface XaiVideoReferenceToVideoOptions extends XaiVideoSharedOptions, XaiVideoUserOptions {
|
|
142
148
|
/**
|
|
143
149
|
* Select reference-to-video mode explicitly for best autocomplete and narrowing.
|
|
144
150
|
*/
|
|
@@ -146,12 +152,12 @@ interface XaiVideoReferenceToVideoOptions extends XaiVideoSharedOptions {
|
|
|
146
152
|
/** Reference image URLs (1-7) for R2V generation. */
|
|
147
153
|
referenceImageUrls: string[];
|
|
148
154
|
}
|
|
149
|
-
interface XaiVideoGenerationOptions extends XaiVideoSharedOptions {
|
|
155
|
+
interface XaiVideoGenerationOptions extends XaiVideoSharedOptions, XaiVideoUserOptions {
|
|
150
156
|
mode?: undefined;
|
|
151
157
|
videoUrl?: undefined;
|
|
152
158
|
referenceImageUrls?: undefined;
|
|
153
159
|
}
|
|
154
|
-
interface XaiLegacyEditVideoOptions extends XaiVideoSharedOptions {
|
|
160
|
+
interface XaiLegacyEditVideoOptions extends XaiVideoSharedOptions, XaiVideoUserOptions {
|
|
155
161
|
/**
|
|
156
162
|
* Legacy backward-compatible shape: omitting `mode` while providing
|
|
157
163
|
* `videoUrl` behaves like edit-video.
|
|
@@ -159,7 +165,7 @@ interface XaiLegacyEditVideoOptions extends XaiVideoSharedOptions {
|
|
|
159
165
|
mode?: undefined;
|
|
160
166
|
videoUrl: string;
|
|
161
167
|
}
|
|
162
|
-
interface XaiLegacyReferenceToVideoOptions extends XaiVideoSharedOptions {
|
|
168
|
+
interface XaiLegacyReferenceToVideoOptions extends XaiVideoSharedOptions, XaiVideoUserOptions {
|
|
163
169
|
/**
|
|
164
170
|
* Legacy backward-compatible shape: omitting `mode` while providing
|
|
165
171
|
* `referenceImageUrls` behaves like reference-to-video.
|
package/dist/index.js
CHANGED
|
@@ -2891,7 +2891,7 @@ var xaiTools = {
|
|
|
2891
2891
|
};
|
|
2892
2892
|
|
|
2893
2893
|
// src/version.ts
|
|
2894
|
-
var VERSION = true ? "3.0.
|
|
2894
|
+
var VERSION = true ? "3.0.109" : "0.0.0-test";
|
|
2895
2895
|
|
|
2896
2896
|
// src/xai-video-model.ts
|
|
2897
2897
|
var import_provider6 = require("@ai-sdk/provider");
|
|
@@ -2909,8 +2909,12 @@ var baseFields = {
|
|
|
2909
2909
|
pollTimeoutMs: import_v416.z.number().positive().nullish(),
|
|
2910
2910
|
resolution: resolutionSchema.nullish()
|
|
2911
2911
|
};
|
|
2912
|
+
var userField = {
|
|
2913
|
+
user: import_v416.z.string().optional()
|
|
2914
|
+
};
|
|
2912
2915
|
var editVideoSchema = import_v416.z.object({
|
|
2913
2916
|
...baseFields,
|
|
2917
|
+
...userField,
|
|
2914
2918
|
mode: import_v416.z.literal("edit-video"),
|
|
2915
2919
|
videoUrl: nonEmptyStringSchema,
|
|
2916
2920
|
referenceImageUrls: import_v416.z.undefined().optional()
|
|
@@ -2923,12 +2927,14 @@ var extendVideoSchema = import_v416.z.object({
|
|
|
2923
2927
|
});
|
|
2924
2928
|
var referenceToVideoSchema = import_v416.z.object({
|
|
2925
2929
|
...baseFields,
|
|
2930
|
+
...userField,
|
|
2926
2931
|
mode: import_v416.z.literal("reference-to-video"),
|
|
2927
2932
|
referenceImageUrls: import_v416.z.array(nonEmptyStringSchema).min(1).max(7),
|
|
2928
2933
|
videoUrl: import_v416.z.undefined().optional()
|
|
2929
2934
|
});
|
|
2930
2935
|
var autoDetectSchema = import_v416.z.object({
|
|
2931
2936
|
...baseFields,
|
|
2937
|
+
...userField,
|
|
2932
2938
|
mode: import_v416.z.undefined().optional(),
|
|
2933
2939
|
videoUrl: nonEmptyStringSchema.optional(),
|
|
2934
2940
|
referenceImageUrls: import_v416.z.array(nonEmptyStringSchema).min(1).max(7).optional()
|
|
@@ -2943,6 +2949,7 @@ var runtimeSchema = import_v416.z.object({
|
|
|
2943
2949
|
mode: modeSchema.optional(),
|
|
2944
2950
|
videoUrl: nonEmptyStringSchema.optional(),
|
|
2945
2951
|
referenceImageUrls: import_v416.z.array(nonEmptyStringSchema).min(1).max(7).optional(),
|
|
2952
|
+
user: import_v416.z.string().optional(),
|
|
2946
2953
|
...baseFields
|
|
2947
2954
|
}).passthrough();
|
|
2948
2955
|
var xaiVideoModelOptionsSchema = (0, import_provider_utils15.lazySchema)(
|
|
@@ -3166,6 +3173,9 @@ var XaiVideoModel = class {
|
|
|
3166
3173
|
details: "xAI only supports inputReferences for reference-to-video generation. The reference images were ignored."
|
|
3167
3174
|
});
|
|
3168
3175
|
}
|
|
3176
|
+
if (!isExtension && (xaiOptions == null ? void 0 : xaiOptions.user) !== void 0) {
|
|
3177
|
+
body.user = xaiOptions.user;
|
|
3178
|
+
}
|
|
3169
3179
|
if (xaiOptions != null) {
|
|
3170
3180
|
for (const [key, value] of Object.entries(xaiOptions)) {
|
|
3171
3181
|
if (![
|
|
@@ -3174,7 +3184,8 @@ var XaiVideoModel = class {
|
|
|
3174
3184
|
"pollTimeoutMs",
|
|
3175
3185
|
"resolution",
|
|
3176
3186
|
"videoUrl",
|
|
3177
|
-
"referenceImageUrls"
|
|
3187
|
+
"referenceImageUrls",
|
|
3188
|
+
"user"
|
|
3178
3189
|
].includes(key)) {
|
|
3179
3190
|
body[key] = value;
|
|
3180
3191
|
}
|