ai 7.0.61 → 7.0.63

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.
@@ -92,7 +92,7 @@ import {
92
92
  } from "@ai-sdk/provider-utils";
93
93
 
94
94
  // src/version.ts
95
- var VERSION = true ? "7.0.61" : "0.0.0-test";
95
+ var VERSION = true ? "7.0.63" : "0.0.0-test";
96
96
 
97
97
  // src/util/download/download.ts
98
98
  var download = async ({
@@ -116,6 +116,7 @@ Here are the capabilities of popular models:
116
116
 
117
117
  | Provider | Model | Image Input | Object Generation | Tool Usage | Tool Streaming |
118
118
  | -------------------------------------------------- | ------------------------------------------- | ----------- | ----------------- | ---------- | -------------- |
119
+ | [xAI Grok](/providers/ai-sdk-providers/xai) | `grok-4.6` | <Check /> | <Check /> | <Check /> | <Check /> |
119
120
  | [xAI Grok](/providers/ai-sdk-providers/xai) | `grok-4.5` | <Check /> | <Check /> | <Check /> | <Check /> |
120
121
  | [xAI Grok](/providers/ai-sdk-providers/xai) | `grok-4` | <Cross /> | <Check /> | <Check /> | <Check /> |
121
122
  | [xAI Grok](/providers/ai-sdk-providers/xai) | `grok-3` | <Cross /> | <Check /> | <Check /> | <Check /> |
@@ -466,20 +466,21 @@ try {
466
466
 
467
467
  ## Video Models
468
468
 
469
- | Provider | Model | Features |
470
- | ----------------------------------------------------------------------- | --------------------------- | ------------------------------------------------------ |
471
- | [FAL](/providers/ai-sdk-providers/fal#video-models) | `luma-dream-machine/ray-2` | Text-to-video, image-to-video |
472
- | [FAL](/providers/ai-sdk-providers/fal#video-models) | `minimax-video` | Text-to-video |
473
- | [Google](/providers/ai-sdk-providers/google#video-models) | `veo-2.0-generate-001` | Text-to-video, up to 4 videos per call |
474
- | [Google Vertex](/providers/ai-sdk-providers/google-vertex#video-models) | `veo-3.1-generate-001` | Text-to-video, audio generation |
475
- | [Google Vertex](/providers/ai-sdk-providers/google-vertex#video-models) | `veo-3.1-fast-generate-001` | Text-to-video, audio generation |
476
- | [Google Vertex](/providers/ai-sdk-providers/google-vertex#video-models) | `veo-3.0-generate-001` | Text-to-video, audio generation |
477
- | [Google Vertex](/providers/ai-sdk-providers/google-vertex#video-models) | `veo-3.0-fast-generate-001` | Text-to-video, audio generation |
478
- | [Google Vertex](/providers/ai-sdk-providers/google-vertex#video-models) | `veo-2.0-generate-001` | Text-to-video, up to 4 videos per call |
479
- | [Kling AI](/providers/ai-sdk-providers/klingai#video-models) | `kling-v2.6-t2v` | Text-to-video |
480
- | [Kling AI](/providers/ai-sdk-providers/klingai#video-models) | `kling-v2.6-i2v` | Image-to-video |
481
- | [Kling AI](/providers/ai-sdk-providers/klingai#video-models) | `kling-v2.6-motion-control` | Motion control |
482
- | [Replicate](/providers/ai-sdk-providers/replicate#video-models) | `minimax/video-01` | Text-to-video |
483
- | [xAI](/providers/ai-sdk-providers/xai#video-models) | `grok-imagine-video` | Text-to-video, image-to-video, editing, extension, R2V |
469
+ | Provider | Model | Features |
470
+ | ----------------------------------------------------------------------- | --------------------------- | ----------------------------------------------------------------------------- |
471
+ | [FAL](/providers/ai-sdk-providers/fal#video-models) | `luma-dream-machine/ray-2` | Text-to-video, image-to-video |
472
+ | [FAL](/providers/ai-sdk-providers/fal#video-models) | `minimax-video` | Text-to-video |
473
+ | [Google](/providers/ai-sdk-providers/google#video-models) | `veo-2.0-generate-001` | Text-to-video, up to 4 videos per call |
474
+ | [Google Vertex](/providers/ai-sdk-providers/google-vertex#video-models) | `veo-3.1-generate-001` | Text-to-video, audio generation |
475
+ | [Google Vertex](/providers/ai-sdk-providers/google-vertex#video-models) | `veo-3.1-fast-generate-001` | Text-to-video, audio generation |
476
+ | [Google Vertex](/providers/ai-sdk-providers/google-vertex#video-models) | `veo-3.0-generate-001` | Text-to-video, audio generation |
477
+ | [Google Vertex](/providers/ai-sdk-providers/google-vertex#video-models) | `veo-3.0-fast-generate-001` | Text-to-video, audio generation |
478
+ | [Google Vertex](/providers/ai-sdk-providers/google-vertex#video-models) | `veo-2.0-generate-001` | Text-to-video, up to 4 videos per call |
479
+ | [Kling AI](/providers/ai-sdk-providers/klingai#video-models) | `kling-v2.6-t2v` | Text-to-video |
480
+ | [Kling AI](/providers/ai-sdk-providers/klingai#video-models) | `kling-v2.6-i2v` | Image-to-video |
481
+ | [Kling AI](/providers/ai-sdk-providers/klingai#video-models) | `kling-v2.6-motion-control` | Motion control |
482
+ | [Replicate](/providers/ai-sdk-providers/replicate#video-models) | `minimax/video-01` | Text-to-video |
483
+ | [xAI](/providers/ai-sdk-providers/xai#video-models) | `grok-imagine-video` | Text-to-video, image-to-video, editing, extension, R2V |
484
+ | [xAI](/providers/ai-sdk-providers/xai#video-models) | `grok-imagine-video-1.5` | Text-to-video, image-to-video, editing, extension, R2V (with reference audio) |
484
485
 
485
486
  Above are a small subset of the video models supported by the AI SDK providers. For more, see the respective provider documentation.
@@ -185,3 +185,24 @@ const { messages, input, handleInputChange, handleSubmit } = useCompletion({
185
185
  ```
186
186
 
187
187
  In this example, the `useCompletion` hook sends a POST request to the `/api/completion` endpoint with the specified headers, additional body fields, and credentials for that fetch request. On your server side, you can handle the request with these additional information.
188
+
189
+ You can provide a type for the additional body fields. The type applies to
190
+ both the body configured on the hook and the body passed to `complete`:
191
+
192
+ ```tsx
193
+ type CompletionBody = {
194
+ model: 'fast' | 'smart';
195
+ };
196
+
197
+ const { complete } = useCompletion<CompletionBody>({
198
+ body: {
199
+ model: 'fast',
200
+ },
201
+ });
202
+
203
+ await complete('What is a completion?', {
204
+ body: {
205
+ model: 'smart',
206
+ },
207
+ });
208
+ ```
@@ -102,6 +102,10 @@ A reasoning part of a message.
102
102
  ```typescript
103
103
  type ReasoningUIPart = {
104
104
  type: 'reasoning';
105
+ /**
106
+ * The reasoning part ID.
107
+ */
108
+ id?: string;
105
109
  /**
106
110
  * The reasoning text.
107
111
  */
@@ -42,6 +42,19 @@ Allows you to create text completion based capabilities for your application. It
42
42
 
43
43
  ## API Signature
44
44
 
45
+ ### Type Parameters
46
+
47
+ <PropertiesTable
48
+ content={[
49
+ {
50
+ name: 'BODY',
51
+ type: 'object',
52
+ description:
53
+ 'The type of the additional request body passed through the hook options or the complete function. Defaults to object.',
54
+ },
55
+ ]}
56
+ />
57
+
45
58
  ### Parameters
46
59
 
47
60
  <PropertiesTable
@@ -88,7 +101,7 @@ Allows you to create text completion based capabilities for your application. It
88
101
  },
89
102
  {
90
103
  name: 'body',
91
- type: 'object',
104
+ type: 'BODY',
92
105
  description:
93
106
  'An optional, additional body object to be passed to the API endpoint.',
94
107
  },
@@ -134,7 +147,7 @@ Allows you to create text completion based capabilities for your application. It
134
147
  },
135
148
  {
136
149
  name: 'complete',
137
- type: '(prompt: string, options?: { headers?: Record<string, string> | Headers, body?: object }) => Promise<string | null | undefined>',
150
+ type: '(prompt: string, options?: { headers?: Record<string, string> | Headers, body?: BODY }) => Promise<string | null | undefined>',
138
151
  description:
139
152
  'Function to execute text completion based on the provided prompt. Returns the completion result when finished.',
140
153
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai",
3
- "version": "7.0.61",
3
+ "version": "7.0.63",
4
4
  "type": "module",
5
5
  "description": "AI SDK by Vercel - build apps like ChatGPT, Claude, Gemini, and more with a single interface for any model using the Vercel AI Gateway or go direct to OpenAI, Anthropic, Google, or any other model provider.",
6
6
  "license": "Apache-2.0",
@@ -42,7 +42,7 @@
42
42
  }
43
43
  },
44
44
  "dependencies": {
45
- "@ai-sdk/gateway": "4.0.49",
45
+ "@ai-sdk/gateway": "4.0.50",
46
46
  "@ai-sdk/provider": "4.0.7",
47
47
  "@ai-sdk/provider-utils": "5.0.27"
48
48
  },
@@ -51,5 +51,5 @@ export type Provider = {
51
51
  *
52
52
  * @throws {NoSuchModelError} If no such model exists.
53
53
  */
54
- rerankingModel(modelId: string): RerankingModel;
54
+ rerankingModel?(modelId: string): RerankingModel;
55
55
  };
@@ -484,6 +484,7 @@ export function processUIMessageStream<UI_MESSAGE extends UIMessage>({
484
484
  case 'reasoning-start': {
485
485
  const reasoningPart: ReasoningUIPart = {
486
486
  type: 'reasoning',
487
+ id: chunk.id,
487
488
  text: '',
488
489
  providerMetadata: chunk.providerMetadata,
489
490
  state: 'streaming',
@@ -135,6 +135,11 @@ export type CustomContentUIPart = {
135
135
  export type ReasoningUIPart = {
136
136
  type: 'reasoning';
137
137
 
138
+ /**
139
+ * The reasoning part ID.
140
+ */
141
+ id?: string;
142
+
138
143
  /**
139
144
  * The reasoning text.
140
145
  */
@@ -1,6 +1,6 @@
1
1
  import type { FetchFunction } from '@ai-sdk/provider-utils';
2
2
 
3
- export type CompletionRequestOptions = {
3
+ export type CompletionRequestOptions<BODY extends object = object> = {
4
4
  /**
5
5
  * An optional object of headers to be passed to the API endpoint.
6
6
  */
@@ -9,10 +9,10 @@ export type CompletionRequestOptions = {
9
9
  /**
10
10
  * An optional object to be passed to the API endpoint.
11
11
  */
12
- body?: object;
12
+ body?: BODY;
13
13
  };
14
14
 
15
- export type UseCompletionOptions = {
15
+ export type UseCompletionOptions<BODY extends object = object> = {
16
16
  /**
17
17
  * The API endpoint that accepts a `{ prompt: string }` object and returns
18
18
  * a stream of tokens of the AI completion response. Defaults to `/api/completion`.
@@ -69,7 +69,7 @@ export type UseCompletionOptions = {
69
69
  * })
70
70
  * ```
71
71
  */
72
- body?: object;
72
+ body?: BODY;
73
73
 
74
74
  /**
75
75
  * Streaming protocol that is used. Defaults to `data`.
@@ -45,6 +45,7 @@ const uiMessagesSchema = lazySchema(() =>
45
45
  }),
46
46
  z.object({
47
47
  type: z.literal('reasoning'),
48
+ id: z.string().optional(),
48
49
  text: z.string(),
49
50
  state: z.enum(['streaming', 'done']).optional(),
50
51
  providerMetadata: providerMetadataSchema.optional(),