@ai-sdk/xai 3.0.50 → 3.0.52
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 +12 -0
- package/dist/index.d.mts +9 -2
- package/dist/index.d.ts +9 -2
- package/dist/index.js +577 -436
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +543 -395
- package/dist/index.mjs.map +1 -1
- package/docs/01-xai.mdx +60 -7
- package/package.json +1 -1
- package/src/convert-xai-chat-usage.ts +2 -2
- package/src/index.ts +1 -0
- package/src/xai-image-model.ts +190 -0
- package/src/xai-image-options.ts +9 -0
- package/src/xai-image-settings.ts +4 -1
- package/src/xai-provider.ts +3 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @ai-sdk/xai
|
|
2
2
|
|
|
3
|
+
## 3.0.52
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- c781168: feat(provider/xai): add dedicated XaiImageModel with JSON-based image editing
|
|
8
|
+
|
|
9
|
+
## 3.0.51
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- e1d5111: fix(provider/xai): correct usage token calculation for reasoning models
|
|
14
|
+
|
|
3
15
|
## 3.0.50
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -56,6 +56,13 @@ declare const xaiErrorDataSchema: z.ZodObject<{
|
|
|
56
56
|
}, z.core.$strip>;
|
|
57
57
|
type XaiErrorData = z.infer<typeof xaiErrorDataSchema>;
|
|
58
58
|
|
|
59
|
+
declare const xaiImageProviderOptions: z.ZodObject<{
|
|
60
|
+
aspect_ratio: z.ZodOptional<z.ZodString>;
|
|
61
|
+
output_format: z.ZodOptional<z.ZodString>;
|
|
62
|
+
sync_mode: z.ZodOptional<z.ZodBoolean>;
|
|
63
|
+
}, z.core.$strip>;
|
|
64
|
+
type XaiImageProviderOptions = z.infer<typeof xaiImageProviderOptions>;
|
|
65
|
+
|
|
59
66
|
type XaiResponsesModelId = 'grok-4-1-fast-reasoning' | 'grok-4-1-fast-non-reasoning' | 'grok-4' | 'grok-4-fast' | 'grok-4-fast-non-reasoning' | (string & {});
|
|
60
67
|
/**
|
|
61
68
|
* @see https://docs.x.ai/docs/api-reference#create-new-response
|
|
@@ -74,7 +81,7 @@ declare const xaiResponsesProviderOptions: z.ZodObject<{
|
|
|
74
81
|
}, z.core.$strip>;
|
|
75
82
|
type XaiResponsesProviderOptions = z.infer<typeof xaiResponsesProviderOptions>;
|
|
76
83
|
|
|
77
|
-
type XaiImageModelId = 'grok-2-image' | (string & {});
|
|
84
|
+
type XaiImageModelId = 'grok-2-image' | 'grok-imagine-image' | (string & {});
|
|
78
85
|
|
|
79
86
|
declare const codeExecutionToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<Record<string, never>, {
|
|
80
87
|
output: string;
|
|
@@ -333,4 +340,4 @@ declare const xai: XaiProvider;
|
|
|
333
340
|
|
|
334
341
|
declare const VERSION: string;
|
|
335
342
|
|
|
336
|
-
export { VERSION, type XaiErrorData, type XaiProvider, type XaiProviderOptions, type XaiProviderSettings, type XaiResponsesProviderOptions, codeExecution, createXai, mcpServer, viewImage, viewXVideo, webSearch, xSearch, xai, xaiTools };
|
|
343
|
+
export { VERSION, type XaiErrorData, type XaiImageProviderOptions, type XaiProvider, type XaiProviderOptions, type XaiProviderSettings, type XaiResponsesProviderOptions, codeExecution, createXai, mcpServer, viewImage, viewXVideo, webSearch, xSearch, xai, xaiTools };
|
package/dist/index.d.ts
CHANGED
|
@@ -56,6 +56,13 @@ declare const xaiErrorDataSchema: z.ZodObject<{
|
|
|
56
56
|
}, z.core.$strip>;
|
|
57
57
|
type XaiErrorData = z.infer<typeof xaiErrorDataSchema>;
|
|
58
58
|
|
|
59
|
+
declare const xaiImageProviderOptions: z.ZodObject<{
|
|
60
|
+
aspect_ratio: z.ZodOptional<z.ZodString>;
|
|
61
|
+
output_format: z.ZodOptional<z.ZodString>;
|
|
62
|
+
sync_mode: z.ZodOptional<z.ZodBoolean>;
|
|
63
|
+
}, z.core.$strip>;
|
|
64
|
+
type XaiImageProviderOptions = z.infer<typeof xaiImageProviderOptions>;
|
|
65
|
+
|
|
59
66
|
type XaiResponsesModelId = 'grok-4-1-fast-reasoning' | 'grok-4-1-fast-non-reasoning' | 'grok-4' | 'grok-4-fast' | 'grok-4-fast-non-reasoning' | (string & {});
|
|
60
67
|
/**
|
|
61
68
|
* @see https://docs.x.ai/docs/api-reference#create-new-response
|
|
@@ -74,7 +81,7 @@ declare const xaiResponsesProviderOptions: z.ZodObject<{
|
|
|
74
81
|
}, z.core.$strip>;
|
|
75
82
|
type XaiResponsesProviderOptions = z.infer<typeof xaiResponsesProviderOptions>;
|
|
76
83
|
|
|
77
|
-
type XaiImageModelId = 'grok-2-image' | (string & {});
|
|
84
|
+
type XaiImageModelId = 'grok-2-image' | 'grok-imagine-image' | (string & {});
|
|
78
85
|
|
|
79
86
|
declare const codeExecutionToolFactory: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<Record<string, never>, {
|
|
80
87
|
output: string;
|
|
@@ -333,4 +340,4 @@ declare const xai: XaiProvider;
|
|
|
333
340
|
|
|
334
341
|
declare const VERSION: string;
|
|
335
342
|
|
|
336
|
-
export { VERSION, type XaiErrorData, type XaiProvider, type XaiProviderOptions, type XaiProviderSettings, type XaiResponsesProviderOptions, codeExecution, createXai, mcpServer, viewImage, viewXVideo, webSearch, xSearch, xai, xaiTools };
|
|
343
|
+
export { VERSION, type XaiErrorData, type XaiImageProviderOptions, type XaiProvider, type XaiProviderOptions, type XaiProviderSettings, type XaiResponsesProviderOptions, codeExecution, createXai, mcpServer, viewImage, viewXVideo, webSearch, xSearch, xai, xaiTools };
|