@ai-sdk/xai 3.0.71 → 3.0.73
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 +23 -8
- package/dist/index.js +18 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -6
- package/src/xai-video-model.ts +16 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-sdk/xai",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.73",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@ai-sdk/openai-compatible": "2.0.
|
|
33
|
-
"@ai-sdk/provider
|
|
34
|
-
"@ai-sdk/provider": "
|
|
32
|
+
"@ai-sdk/openai-compatible": "2.0.37",
|
|
33
|
+
"@ai-sdk/provider": "3.0.8",
|
|
34
|
+
"@ai-sdk/provider-utils": "4.0.21"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/node": "20.17.24",
|
|
@@ -65,9 +65,7 @@
|
|
|
65
65
|
"build": "pnpm clean && tsup --tsconfig tsconfig.build.json",
|
|
66
66
|
"build:watch": "pnpm clean && tsup --watch",
|
|
67
67
|
"clean": "del-cli dist docs *.tsbuildinfo",
|
|
68
|
-
"lint": "eslint \"./**/*.ts*\"",
|
|
69
68
|
"type-check": "tsc --build",
|
|
70
|
-
"prettier-check": "prettier --check \"./**/*.ts*\"",
|
|
71
69
|
"test": "pnpm test:node && pnpm test:edge",
|
|
72
70
|
"test:update": "pnpm test:node -u",
|
|
73
71
|
"test:watch": "vitest --config vitest.node.config.js",
|
package/src/xai-video-model.ts
CHANGED
|
@@ -239,6 +239,14 @@ export class XaiVideoModel implements Experimental_VideoModelV3 {
|
|
|
239
239
|
statusResponse.status === 'done' ||
|
|
240
240
|
(statusResponse.status == null && statusResponse.video?.url)
|
|
241
241
|
) {
|
|
242
|
+
if (statusResponse.video?.respect_moderation === false) {
|
|
243
|
+
throw new AISDKError({
|
|
244
|
+
name: 'XAI_VIDEO_MODERATION_ERROR',
|
|
245
|
+
message:
|
|
246
|
+
'Video generation was blocked due to a content policy violation.',
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
|
|
242
250
|
if (!statusResponse.video?.url) {
|
|
243
251
|
throw new AISDKError({
|
|
244
252
|
name: 'XAI_VIDEO_GENERATION_ERROR',
|
|
@@ -268,6 +276,9 @@ export class XaiVideoModel implements Experimental_VideoModelV3 {
|
|
|
268
276
|
...(statusResponse.video.duration != null
|
|
269
277
|
? { duration: statusResponse.video.duration }
|
|
270
278
|
: {}),
|
|
279
|
+
...(statusResponse.usage?.cost_in_usd_ticks != null
|
|
280
|
+
? { costInUsdTicks: statusResponse.usage.cost_in_usd_ticks }
|
|
281
|
+
: {}),
|
|
271
282
|
},
|
|
272
283
|
},
|
|
273
284
|
};
|
|
@@ -299,4 +310,9 @@ const xaiVideoStatusResponseSchema = z.object({
|
|
|
299
310
|
})
|
|
300
311
|
.nullish(),
|
|
301
312
|
model: z.string().nullish(),
|
|
313
|
+
usage: z
|
|
314
|
+
.object({
|
|
315
|
+
cost_in_usd_ticks: z.number().nullish(),
|
|
316
|
+
})
|
|
317
|
+
.nullish(),
|
|
302
318
|
});
|