@ai-sdk/xai 4.0.41 → 4.0.42

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/xai",
3
- "version": "4.0.41",
3
+ "version": "4.0.42",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "sideEffects": false,
@@ -162,6 +162,12 @@ export class XaiImageModel implements ImageModelV4 {
162
162
  fetch: this.config.fetch,
163
163
  });
164
164
 
165
+ if (response.data.some(image => image.respect_moderation === false)) {
166
+ throw new Error(
167
+ 'Image generation was blocked due to a content policy violation.',
168
+ );
169
+ }
170
+
165
171
  const hasAllBase64 = response.data.every(image => image.b64_json != null);
166
172
 
167
173
  const images = hasAllBase64
@@ -219,6 +225,7 @@ const xaiImageResponseSchema = z.object({
219
225
  url: z.string().nullish(),
220
226
  b64_json: z.string().nullish(),
221
227
  revised_prompt: z.string().nullish(),
228
+ respect_moderation: z.boolean().nullish(),
222
229
  }),
223
230
  ),
224
231
  usage: z