@ai-sdk/xai 4.0.14 → 4.0.15

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @ai-sdk/xai
2
2
 
3
+ ## 4.0.15
4
+
5
+ ### Patch Changes
6
+
7
+ - 91a3d6e: feat(provider/xai): support end-user identifiers for video generation and editing
8
+
3
9
  ## 4.0.14
4
10
 
5
11
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -127,7 +127,13 @@ interface XaiVideoSharedOptions {
127
127
  pollTimeoutMs?: number | null;
128
128
  resolution?: XaiVideoResolution | null;
129
129
  }
130
- interface XaiVideoEditModeOptions extends XaiVideoSharedOptions {
130
+ interface XaiVideoUserOptions {
131
+ /**
132
+ * A unique identifier representing the end user, for abuse monitoring.
133
+ */
134
+ user?: string;
135
+ }
136
+ interface XaiVideoEditModeOptions extends XaiVideoSharedOptions, XaiVideoUserOptions {
131
137
  /**
132
138
  * Select edit-video mode explicitly for best autocomplete and narrowing.
133
139
  */
@@ -143,7 +149,7 @@ interface XaiVideoExtendModeOptions extends XaiVideoSharedOptions {
143
149
  /** Source video URL to extend from its last frame. */
144
150
  videoUrl: string;
145
151
  }
146
- interface XaiVideoReferenceToVideoOptions extends XaiVideoSharedOptions {
152
+ interface XaiVideoReferenceToVideoOptions extends XaiVideoSharedOptions, XaiVideoUserOptions {
147
153
  /**
148
154
  * Select reference-to-video mode explicitly for best autocomplete and narrowing.
149
155
  */
@@ -151,12 +157,12 @@ interface XaiVideoReferenceToVideoOptions extends XaiVideoSharedOptions {
151
157
  /** Reference image URLs (1-7) for R2V generation. */
152
158
  referenceImageUrls: string[];
153
159
  }
154
- interface XaiVideoGenerationOptions extends XaiVideoSharedOptions {
160
+ interface XaiVideoGenerationOptions extends XaiVideoSharedOptions, XaiVideoUserOptions {
155
161
  mode?: undefined;
156
162
  videoUrl?: undefined;
157
163
  referenceImageUrls?: undefined;
158
164
  }
159
- interface XaiLegacyEditVideoOptions extends XaiVideoSharedOptions {
165
+ interface XaiLegacyEditVideoOptions extends XaiVideoSharedOptions, XaiVideoUserOptions {
160
166
  /**
161
167
  * Legacy backward-compatible shape: omitting `mode` while providing
162
168
  * `videoUrl` behaves like edit-video.
@@ -164,7 +170,7 @@ interface XaiLegacyEditVideoOptions extends XaiVideoSharedOptions {
164
170
  mode?: undefined;
165
171
  videoUrl: string;
166
172
  }
167
- interface XaiLegacyReferenceToVideoOptions extends XaiVideoSharedOptions {
173
+ interface XaiLegacyReferenceToVideoOptions extends XaiVideoSharedOptions, XaiVideoUserOptions {
168
174
  /**
169
175
  * Legacy backward-compatible shape: omitting `mode` while providing
170
176
  * `referenceImageUrls` behaves like reference-to-video.
package/dist/index.js CHANGED
@@ -3477,7 +3477,7 @@ var xaiTools = {
3477
3477
  };
3478
3478
 
3479
3479
  // src/version.ts
3480
- var VERSION = true ? "4.0.14" : "0.0.0-test";
3480
+ var VERSION = true ? "4.0.15" : "0.0.0-test";
3481
3481
 
3482
3482
  // src/files/xai-files.ts
3483
3483
  import {
@@ -3607,8 +3607,12 @@ var baseFields = {
3607
3607
  pollTimeoutMs: z18.number().positive().nullish(),
3608
3608
  resolution: resolutionSchema.nullish()
3609
3609
  };
3610
+ var userField = {
3611
+ user: z18.string().optional()
3612
+ };
3610
3613
  var editVideoSchema = z18.object({
3611
3614
  ...baseFields,
3615
+ ...userField,
3612
3616
  mode: z18.literal("edit-video"),
3613
3617
  videoUrl: nonEmptyStringSchema,
3614
3618
  referenceImageUrls: z18.undefined().optional()
@@ -3621,12 +3625,14 @@ var extendVideoSchema = z18.object({
3621
3625
  });
3622
3626
  var referenceToVideoSchema = z18.object({
3623
3627
  ...baseFields,
3628
+ ...userField,
3624
3629
  mode: z18.literal("reference-to-video"),
3625
3630
  referenceImageUrls: z18.array(nonEmptyStringSchema).min(1).max(7),
3626
3631
  videoUrl: z18.undefined().optional()
3627
3632
  });
3628
3633
  var autoDetectSchema = z18.object({
3629
3634
  ...baseFields,
3635
+ ...userField,
3630
3636
  mode: z18.undefined().optional(),
3631
3637
  videoUrl: nonEmptyStringSchema.optional(),
3632
3638
  referenceImageUrls: z18.array(nonEmptyStringSchema).min(1).max(7).optional()
@@ -3641,6 +3647,7 @@ var runtimeSchema = z18.looseObject({
3641
3647
  mode: modeSchema.optional(),
3642
3648
  videoUrl: nonEmptyStringSchema.optional(),
3643
3649
  referenceImageUrls: z18.array(nonEmptyStringSchema).min(1).max(7).optional(),
3650
+ user: z18.string().optional(),
3644
3651
  ...baseFields
3645
3652
  });
3646
3653
  var xaiVideoModelOptionsSchema = lazySchema7(
@@ -3860,6 +3867,9 @@ var XaiVideoModel = class {
3860
3867
  details: "xAI only supports inputReferences for reference-to-video generation. The reference images were ignored."
3861
3868
  });
3862
3869
  }
3870
+ if (!isExtension && (xaiOptions == null ? void 0 : xaiOptions.user) !== void 0) {
3871
+ body.user = xaiOptions.user;
3872
+ }
3863
3873
  if (xaiOptions != null) {
3864
3874
  for (const [key, value] of Object.entries(xaiOptions)) {
3865
3875
  if (![
@@ -3868,7 +3878,8 @@ var XaiVideoModel = class {
3868
3878
  "pollTimeoutMs",
3869
3879
  "resolution",
3870
3880
  "videoUrl",
3871
- "referenceImageUrls"
3881
+ "referenceImageUrls",
3882
+ "user"
3872
3883
  ].includes(key)) {
3873
3884
  body[key] = value;
3874
3885
  }