ai 7.0.94 → 7.0.96

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.
@@ -91,7 +91,7 @@ import {
91
91
  } from "@ai-sdk/provider-utils";
92
92
 
93
93
  // src/version.ts
94
- var VERSION = true ? "7.0.94" : "0.0.0-test";
94
+ var VERSION = true ? "7.0.96" : "0.0.0-test";
95
95
 
96
96
  // src/util/download/download.ts
97
97
  var download = async ({
@@ -314,6 +314,8 @@ for (const file of result.files) {
314
314
  | Provider | Model | Support sizes (`width x height`) or aspect ratios (`width : height`) |
315
315
  | ------------------------------------------------------------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
316
316
  | [xAI Grok](/providers/ai-sdk-providers/xai#image-models) | `grok-imagine-image` | `1:1`, `16:9`, `9:16`, `4:3`, `3:4`, `3:2`, `2:3`, `2:1`, `1:2`, `19.5:9`, `9:19.5`, `20:9`, `9:20`, `auto` |
317
+ | [OpenAI](/providers/ai-sdk-providers/openai#image-models) | `gpt-image-2.5-flare` | 1024x1024, 1536x1024, 1024x1536, custom |
318
+ | [OpenAI](/providers/ai-sdk-providers/openai#image-models) | `gpt-image-2.5-sunburst` | 1024x1024, 1536x1024, 1024x1536, custom |
317
319
  | [OpenAI](/providers/ai-sdk-providers/openai#image-models) | `gpt-image-2` | 1024x1024, 1536x1024, 1024x1536 |
318
320
  | [OpenAI](/providers/ai-sdk-providers/openai#image-models) | `dall-e-3` | 1024x1024, 1792x1024, 1024x1792 |
319
321
  | [OpenAI](/providers/ai-sdk-providers/openai#image-models) | `dall-e-2` | 256x256, 512x512, 1024x1024 |
@@ -0,0 +1,333 @@
1
+ ---
2
+ title: Batch
3
+ description: Learn how to process asynchronous batches with the AI SDK.
4
+ ---
5
+
6
+ # Batch
7
+
8
+ <Note type="warning">
9
+ Batch support is experimental and the API may change in patch releases.
10
+ </Note>
11
+
12
+ Batches let you submit multiple independent requests for asynchronous
13
+ processing. The provider processes the batch in the background, so your
14
+ application does not need to keep the request open while the model generates
15
+ the results. This is useful for workloads such as classification,
16
+ summarization, and content generation that do not need an immediate response.
17
+
18
+ The batch API is designed to support multiple request types. Currently, only
19
+ `type: 'text'` is supported.
20
+
21
+ The AI SDK provides five functions for the batch lifecycle:
22
+
23
+ - [`experimental_startBatch`](/docs/reference/ai-sdk-core/start-batch)
24
+ submits a batch and returns its initial status and a serializable reference.
25
+ - [`experimental_getBatchStatus`](/docs/reference/ai-sdk-core/get-batch-status)
26
+ retrieves the latest status and request counts.
27
+ - [`experimental_getBatchResults`](/docs/reference/ai-sdk-core/get-batch-results)
28
+ asynchronously iterates over the terminal result for each request.
29
+ - [`experimental_cancelBatch`](/docs/reference/ai-sdk-core/cancel-batch)
30
+ requests cancellation of a batch.
31
+ - [`experimental_listBatches`](/docs/reference/ai-sdk-core/list-batches)
32
+ lists batches and their latest statuses.
33
+
34
+ All five functions are exported from `ai`. The examples below use aliases so
35
+ the shorter names can be used in application code:
36
+
37
+ ```ts
38
+ import {
39
+ experimental_cancelBatch as cancelBatch,
40
+ experimental_getBatchResults as getBatchResults,
41
+ experimental_getBatchStatus as getBatchStatus,
42
+ experimental_listBatches as listBatches,
43
+ experimental_startBatch as startBatch,
44
+ } from 'ai';
45
+ ```
46
+
47
+ Cancellation and listing are optional provider capabilities. Calling either
48
+ function with a provider that does not implement it throws an
49
+ `UnsupportedFunctionalityError`. In the cancellation and listing examples
50
+ below, `provider` represents a batch provider that implements the respective
51
+ capability.
52
+
53
+ ## Supported providers
54
+
55
+ Batch processing requires a provider that implements the batch interface.
56
+ Support is provider- and model-specific. The first-party providers with
57
+ support are:
58
+
59
+ | Provider | Provider value | Model example | Provider API |
60
+ | ---------------------------------------------------- | -------------- | ------------------------------ | --------------------------------------------------------------------------------------------- |
61
+ | [Anthropic](/providers/ai-sdk-providers/anthropic) | `anthropic` | `'claude-haiku-4-5'` | [Message Batches API](https://platform.claude.com/docs/en/build-with-claude/batch-processing) |
62
+ | [Google](/providers/ai-sdk-providers/google) | `google` | `'gemini-3.6-flash'` | [Gemini Batch API](https://ai.google.dev/gemini-api/docs/batch-api) |
63
+ | [OpenAI](/providers/ai-sdk-providers/openai) | `openai` | `'gpt-4.1-nano'` | [Batch API](https://developers.openai.com/api/docs/guides/batch) |
64
+ | [xAI](/providers/ai-sdk-providers/xai) | `xai` | `'grok-4.3'` | [Batch API](https://docs.x.ai/developers/advanced-api-usage/batch-api) |
65
+ | [AI Gateway](/providers/ai-sdk-providers/ai-gateway) | global default | `'anthropic/claude-haiku-4.5'` | [Batch processing](https://vercel.com/docs/ai-gateway/models-and-providers/batch-processing) |
66
+
67
+ See the provider documentation for the supported models, limits, and native
68
+ batch behavior. For example, OpenAI batch support is available through the
69
+ Responses API, not `openai.chat()`, and xAI batch support is available through
70
+ the Responses API, not `xai.chat()`.
71
+
72
+ ## Starting a batch
73
+
74
+ Pass a provider and one or more uniquely identified requests to `startBatch`.
75
+ Each request must specify `type: 'text'`, a model ID, and either a text `prompt`
76
+ or a `messages` array. Requests can use different model IDs when supported by
77
+ the provider. Each request can also use the usual text-generation settings such
78
+ as `instructions`, `maxOutputTokens`, `temperature`, `topP`, `topK`,
79
+ `presencePenalty`, `frequencyPenalty`, `stopSequences`, `seed`, and `reasoning`.
80
+
81
+ Tool definitions and tool settings are provided on individual requests. A tool
82
+ with the same name must have the same definition in every request that uses it.
83
+
84
+ ```ts
85
+ import { anthropic } from '@ai-sdk/anthropic';
86
+ import { experimental_startBatch as startBatch } from 'ai';
87
+
88
+ const provider = anthropic;
89
+
90
+ const batch = await startBatch({
91
+ provider,
92
+ requests: [
93
+ {
94
+ id: 'capital-france',
95
+ type: 'text',
96
+ model: 'claude-haiku-4-5',
97
+ prompt: 'What is the capital of France?',
98
+ },
99
+ {
100
+ id: 'capital-germany',
101
+ type: 'text',
102
+ model: 'claude-haiku-4-5',
103
+ prompt: 'What is the capital of Germany?',
104
+ },
105
+ ],
106
+ });
107
+
108
+ console.log(batch.id, batch.status);
109
+ ```
110
+
111
+ Request IDs must be non-empty and unique within the batch. They are the link
112
+ between an input request and its result. Results are not guaranteed to arrive
113
+ in input order, so use the ID rather than an array position when associating a
114
+ result with application data.
115
+
116
+ You can pass provider-specific settings at the batch level with
117
+ `providerOptions`, or on an individual request with that request's
118
+ `providerOptions`. Settings supported by the provider can differ between the
119
+ two levels. The `warnings` property on the start result contains warnings about
120
+ unsupported settings.
121
+
122
+ The batch reference returned by `startBatch` is serializable. Persist it
123
+ before the process exits if the batch will be completed by another process or
124
+ at a later time. When retrieving a batch, pass the same provider. The AI SDK
125
+ uses the reference to ensure that a batch is not read through an incompatible
126
+ provider.
127
+
128
+ ## Batch tools
129
+
130
+ Batch text requests support both client-defined tools and provider-defined
131
+ tools. Tool definitions are sent with each request that includes them, so the
132
+ model can call them independently for each request.
133
+
134
+ Client-defined tools are definition-only in a batch. Their `execute` functions
135
+ are never invoked, and the AI SDK does not submit tool results or start a
136
+ follow-up generation after retrieving a tool call. Pass the same tool set to
137
+ `getBatchResults` to validate and normalize returned tool calls:
138
+
139
+ ```ts
140
+ import { anthropic } from '@ai-sdk/anthropic';
141
+ import {
142
+ experimental_getBatchResults as getBatchResults,
143
+ experimental_startBatch as startBatch,
144
+ tool,
145
+ } from 'ai';
146
+ import { z } from 'zod';
147
+
148
+ const tools = {
149
+ get_weather: tool({
150
+ description: 'Get the current weather for a location.',
151
+ inputSchema: z.object({ location: z.string() }),
152
+ execute: async ({ location }) => {
153
+ // This function is not called by batch processing.
154
+ return { location, temperature: 21, condition: 'sunny' };
155
+ },
156
+ }),
157
+ };
158
+
159
+ const batch = await startBatch({
160
+ provider: anthropic,
161
+ requests: [
162
+ {
163
+ id: 'weather-san-francisco',
164
+ type: 'text',
165
+ model: 'claude-haiku-4-5',
166
+ prompt: 'Call get_weather for San Francisco, California.',
167
+ tools,
168
+ toolChoice: { type: 'tool', toolName: 'get_weather' },
169
+ },
170
+ ],
171
+ });
172
+
173
+ for await (const item of getBatchResults({
174
+ provider: anthropic,
175
+ batch,
176
+ tools,
177
+ })) {
178
+ if (item.status === 'succeeded') {
179
+ console.log(item.id, item.content);
180
+ }
181
+ }
182
+ ```
183
+
184
+ Provider-defined tools, such as web search or code execution, can execute on
185
+ the provider when supported by that provider's batch API. Their tool calls and
186
+ results are returned as normalized `content` parts. See the provider
187
+ documentation for the tools and models available in batches.
188
+
189
+ ## Checking batch status
190
+
191
+ The start result includes the initial status. Use `getBatchStatus` to retrieve
192
+ the latest status while the provider is processing the batch:
193
+
194
+ ```ts
195
+ import { setTimeout } from 'node:timers/promises';
196
+
197
+ let status = batch.status;
198
+ let error = batch.error;
199
+
200
+ while (status === 'pending') {
201
+ await setTimeout(10_000);
202
+ const latestStatus = await getBatchStatus({
203
+ provider: anthropic,
204
+ batch,
205
+ });
206
+ status = latestStatus.status;
207
+ error = latestStatus.error;
208
+ }
209
+
210
+ if (status === 'failed') {
211
+ throw new Error(error?.message ?? 'The batch failed.');
212
+ }
213
+ ```
214
+
215
+ The normalized batch status is one of:
216
+
217
+ - `pending` — the provider is still processing the batch.
218
+ - `completed` — the batch reached a terminal state and results can be
219
+ retrieved.
220
+ - `failed` — the batch could not be completed. The `error` property may
221
+ contain additional details.
222
+
223
+ Status responses can also include `requestCounts`, `createdAt`, `expiresAt`,
224
+ `rawStatus`, and provider metadata. `requestCounts` reports the total,
225
+ pending, completed, and failed requests known by the provider.
226
+
227
+ For webhook-capable providers, pass `webhookUrl` to `startBatch` to
228
+ receive a notification when the batch reaches a terminal state. Webhook
229
+ support and payloads are provider-specific. The provider pages linked above
230
+ describe their webhook behavior; providers that do not support webhooks return
231
+ an unsupported warning and continue without one.
232
+
233
+ ## Cancelling a batch
234
+
235
+ Use `cancelBatch` to ask the provider to stop processing a batch:
236
+
237
+ ```ts
238
+ const result = await cancelBatch({
239
+ provider,
240
+ batch,
241
+ });
242
+
243
+ console.log(result.providerMetadata);
244
+ ```
245
+
246
+ A successful call means that the provider accepted the cancellation request.
247
+ It does not guarantee that cancellation has finished or that every pending
248
+ request will be cancelled. Use `getBatchStatus` to retrieve the latest status
249
+ after requesting cancellation.
250
+
251
+ The result can include provider metadata with additional information from the
252
+ cancellation response.
253
+
254
+ ## Listing batches
255
+
256
+ Use `listBatches` to retrieve batches from the provider. Results are paginated.
257
+ Pass the returned `nextCursor` as `cursor` to retrieve the next page:
258
+
259
+ ```ts
260
+ let cursor: string | undefined;
261
+
262
+ do {
263
+ const page = await listBatches({
264
+ provider,
265
+ limit: 20,
266
+ cursor,
267
+ });
268
+
269
+ for (const batch of page.batches) {
270
+ console.log(batch.id, batch.status);
271
+ }
272
+
273
+ cursor = page.nextCursor;
274
+ } while (cursor != null);
275
+ ```
276
+
277
+ Each item is a serializable batch reference with its latest normalized status,
278
+ so it can be passed directly to `getBatchStatus`, `getBatchResults`, or
279
+ `cancelBatch`. Cursors are opaque and provider-specific; applications should
280
+ store or pass them unchanged rather than inspect their contents.
281
+
282
+ ## Retrieving results
283
+
284
+ After the batch is complete, `getBatchResults` returns an async iterable. Each
285
+ item contains the ID and terminal status for one input request:
286
+
287
+ ```ts
288
+ for await (const item of getBatchResults({ provider: anthropic, batch })) {
289
+ if (item.status === 'succeeded') {
290
+ console.log(item.id, item.text);
291
+ } else {
292
+ console.error(item.id, item.status, item.error);
293
+ }
294
+ }
295
+ ```
296
+
297
+ Successful items include:
298
+
299
+ - `text` — the concatenated text content. This can be an empty string when the
300
+ result contains no text parts.
301
+ - `content` — ordered, normalized content parts, including text, reasoning,
302
+ files, sources, tool calls, tool results, and provider content where
303
+ supported.
304
+ - `finishReason` and optional `rawFinishReason`.
305
+ - `usage` and optional `response` metadata.
306
+ - Optional `providerMetadata`.
307
+
308
+ Failed, cancelled, and expired items include their `id` and status. Failed
309
+ items include an `error`; cancelled and expired items may also include one.
310
+ One failed request does not necessarily mean that every request in the batch
311
+ failed, so handle each item independently.
312
+
313
+ Batch retrieval does not run an AI SDK tool loop or invoke client-defined
314
+ `execute` functions. Provider-defined tools may execute on the provider as part
315
+ of batch processing. Treat result content and provider metadata as untrusted
316
+ model output, and avoid logging it indiscriminately because it can contain
317
+ sensitive data.
318
+
319
+ ## Request controls
320
+
321
+ All batch lifecycle functions accept `providerOptions`, `headers`, `timeout`,
322
+ and `abortSignal` for the current operation. `getBatchStatus`,
323
+ `getBatchResults`, and `listBatches` also accept `maxRetries`:
324
+
325
+ - `maxRetries` controls retries for status, result retrieval, and listing. It
326
+ does not retry batch creation or cancellation. It defaults to 2; set it to 0
327
+ to disable retries.
328
+ - `abortSignal` cancels the current API request.
329
+ - `timeout` limits the current HTTP operation.
330
+
331
+ These controls affect communication with the provider. They do not change the
332
+ provider's processing deadline or cancel a batch that has already been
333
+ submitted.
@@ -98,6 +98,11 @@ description: Learn about AI SDK Core.
98
98
  description: 'Learn how to generate speech with AI SDK Core.',
99
99
  href: '/docs/ai-sdk-core/speech',
100
100
  },
101
+ {
102
+ title: 'Batch',
103
+ description: 'Submit requests for asynchronous batch processing.',
104
+ href: '/docs/ai-sdk-core/batch',
105
+ },
101
106
  {
102
107
  title: 'File Uploads',
103
108
  description: 'Learn how to upload files to providers with the AI SDK.',
@@ -20,6 +20,7 @@ The AI SDK includes the following harness adapters:
20
20
  - [Cursor](/providers/ai-sdk-harnesses/cursor) (`@ai-sdk/harness-cursor`)
21
21
  - [Deep Agents](/providers/ai-sdk-harnesses/deepagents) (`@ai-sdk/harness-deepagents`)
22
22
  - [fx](/providers/ai-sdk-harnesses/fx) (`@ai-sdk/harness-fx`)
23
+ - [GitHub Copilot](/providers/ai-sdk-harnesses/github-copilot) (`@ai-sdk/harness-github-copilot`)
23
24
  - [Grok Build](/providers/ai-sdk-harnesses/grok-build) (`@ai-sdk/harness-grok-build`)
24
25
  - [OpenCode](/providers/ai-sdk-harnesses/opencode) (`@ai-sdk/harness-opencode`)
25
26
  - [Pi](/providers/ai-sdk-harnesses/pi) (`@ai-sdk/harness-pi`)
@@ -32,14 +33,15 @@ The AI SDK includes the following harness adapters:
32
33
 
33
34
  ## Adapter Capabilities
34
35
 
35
- | Adapter | Runtime location | Custom tools | Custom skills | Structured output | Built-in tool approval | Built-in tool filtering |
36
- | ------------------------------------------------------ | ---------------- | ------------ | ------------- | ----------------- | ---------------------- | ---------------------------- |
37
- | [Claude Code](/providers/ai-sdk-harnesses/claude-code) | Sandbox bridge | <Check /> | <Check /> | <Check /> | <Check /> | <Check /> |
38
- | [Cline](/providers/ai-sdk-harnesses/cline) | Host process | <Check /> | <Check /> | <Check /> | <Check /> | <Check /> |
39
- | [Codex](/providers/ai-sdk-harnesses/codex) | Sandbox bridge | <Check /> | <Check /> | <Check /> | <Cross /> | <Cross /> |
40
- | [Cursor](/providers/ai-sdk-harnesses/cursor) | Sandbox via ACP | <Check /> | <Check /> | <Cross /> | <Check /> | <Cross /> |
41
- | [Deep Agents](/providers/ai-sdk-harnesses/deepagents) | Sandbox bridge | <Check /> | <Check /> | <Check /> | <Check /> | <Check /> via auto-rejection |
42
- | [fx](/providers/ai-sdk-harnesses/fx) | Sandbox via ACP | <Check /> | <Check /> | <Cross /> | <Check /> | <Cross /> |
43
- | [Grok Build](/providers/ai-sdk-harnesses/grok-build) | Sandbox via ACP | <Check /> | <Check /> | <Check /> | <Check /> | <Cross /> |
44
- | [OpenCode](/providers/ai-sdk-harnesses/opencode) | Sandbox bridge | <Check /> | <Check /> | <Check /> | <Check /> | <Check /> via auto-rejection |
45
- | [Pi](/providers/ai-sdk-harnesses/pi) | Host process | <Check /> | <Check /> | <Cross /> | <Check /> | <Check /> |
36
+ | Adapter | Runtime location | Custom tools | Custom skills | Structured output | Built-in tool approval | Built-in tool filtering |
37
+ | ------------------------------------------------------------ | ---------------- | ------------ | ------------- | ----------------- | ---------------------- | ---------------------------- |
38
+ | [Claude Code](/providers/ai-sdk-harnesses/claude-code) | Sandbox bridge | <Check /> | <Check /> | <Check /> | <Check /> | <Check /> |
39
+ | [Cline](/providers/ai-sdk-harnesses/cline) | Host process | <Check /> | <Check /> | <Check /> | <Check /> | <Check /> |
40
+ | [Codex](/providers/ai-sdk-harnesses/codex) | Sandbox bridge | <Check /> | <Check /> | <Check /> | <Cross /> | <Cross /> |
41
+ | [Cursor](/providers/ai-sdk-harnesses/cursor) | Sandbox via ACP | <Check /> | <Check /> | <Cross /> | <Check /> | <Cross /> |
42
+ | [Deep Agents](/providers/ai-sdk-harnesses/deepagents) | Sandbox bridge | <Check /> | <Check /> | <Check /> | <Check /> | <Check /> via auto-rejection |
43
+ | [fx](/providers/ai-sdk-harnesses/fx) | Sandbox via ACP | <Check /> | <Check /> | <Cross /> | <Check /> | <Cross /> |
44
+ | [GitHub Copilot](/providers/ai-sdk-harnesses/github-copilot) | Sandbox via ACP | <Check /> | <Check /> | <Cross /> | <Check /> | <Cross /> |
45
+ | [Grok Build](/providers/ai-sdk-harnesses/grok-build) | Sandbox via ACP | <Check /> | <Check /> | <Check /> | <Check /> | <Cross /> |
46
+ | [OpenCode](/providers/ai-sdk-harnesses/opencode) | Sandbox bridge | <Check /> | <Check /> | <Check /> | <Check /> | <Check /> via auto-rejection |
47
+ | [Pi](/providers/ai-sdk-harnesses/pi) | Host process | <Check /> | <Check /> | <Cross /> | <Check /> | <Check /> |
@@ -110,6 +110,13 @@ export const cacheMiddleware: LanguageModelV4Middleware = {
110
110
  responses but you can use any KV storage provider you would like.
111
111
  </Note>
112
112
 
113
+ <Note>
114
+ This middleware caches the raw model response before AI SDK validates
115
+ structured output. When using structured output, cache only a response that
116
+ has passed your schema validation; otherwise, an invalid response can be
117
+ replayed from the cache on later requests.
118
+ </Note>
119
+
113
120
  `LanguageModelV4Middleware` has two methods: `wrapGenerate` and `wrapStream`. `wrapGenerate` is called when using [`generateText`](/docs/reference/ai-sdk-core/generate-text), while `wrapStream` is called when using [`streamText`](/docs/reference/ai-sdk-core/stream-text).
114
121
 
115
122
  For `wrapGenerate`, you can cache the response directly. Instead, for `wrapStream`, you cache an array of the stream parts, which can then be used with [`simulateReadableStream`](/docs/ai-sdk-core/testing#simulate-ui-message-stream-responses) function to create a simulated `ReadableStream` that returns the cached response. In this way, the cached response is returned chunk-by-chunk as if it were being generated by the model. You can control the initial delay and delay between chunks by adjusting the `initialDelayInMs` and `chunkDelayInMs` parameters of `simulateReadableStream`.
@@ -0,0 +1,155 @@
1
+ ---
2
+ title: experimental_startBatch
3
+ description: API Reference for experimental_startBatch.
4
+ ---
5
+
6
+ # `experimental_startBatch()`
7
+
8
+ <Note type="warning">
9
+ Batch support is experimental and the API may change in patch releases.
10
+ </Note>
11
+
12
+ Starts an asynchronous batch. Currently, only `type: 'text'` requests are
13
+ supported. For a complete guide to the batch lifecycle, see
14
+ [Batch](/docs/ai-sdk-core/batch).
15
+
16
+ ```ts
17
+ import { experimental_startBatch as startBatch } from 'ai';
18
+
19
+ const batch = await startBatch({
20
+ requests: [
21
+ {
22
+ id: 'france',
23
+ type: 'text',
24
+ model: 'gpt-4.1-nano',
25
+ prompt: 'What is the capital of France?',
26
+ },
27
+ ],
28
+ });
29
+ ```
30
+
31
+ ## Import
32
+
33
+ <Snippet text={`import { experimental_startBatch } from "ai"`} prompt={false} />
34
+
35
+ ## API Signature
36
+
37
+ ### Parameters
38
+
39
+ <PropertiesTable
40
+ content={[
41
+ {
42
+ name: 'provider',
43
+ type: 'Experimental_BatchProvider',
44
+ isOptional: true,
45
+ description:
46
+ 'The provider to use. Defaults to the global provider, or the AI Gateway when no global provider is configured.',
47
+ },
48
+ {
49
+ name: 'requests',
50
+ type: 'Array<Experimental_BatchRequest>',
51
+ description:
52
+ 'The independent requests to process. Each request must have a unique, non-empty id, a supported type, and type-specific properties such as model and prompt or messages for text requests.',
53
+ },
54
+ {
55
+ name: 'providerOptions',
56
+ type: 'ProviderOptions',
57
+ isOptional: true,
58
+ description: 'Additional provider-specific options for the batch.',
59
+ },
60
+ {
61
+ name: 'webhookUrl',
62
+ type: 'string',
63
+ isOptional: true,
64
+ description:
65
+ 'URL to notify when the batch reaches a terminal state. Support and payloads are provider-specific.',
66
+ },
67
+ {
68
+ name: 'abortSignal',
69
+ type: 'AbortSignal',
70
+ isOptional: true,
71
+ description:
72
+ 'An optional abort signal to cancel the request that starts the batch.',
73
+ },
74
+ {
75
+ name: 'timeout',
76
+ type: 'number | { totalMs?: number }',
77
+ isOptional: true,
78
+ description: 'Maximum time allowed for the batch creation request.',
79
+ },
80
+ {
81
+ name: 'headers',
82
+ type: 'Record<string, string | undefined>',
83
+ isOptional: true,
84
+ description: 'Additional HTTP headers for the request.',
85
+ },
86
+ ]}
87
+ />
88
+
89
+ ### Returns
90
+
91
+ <PropertiesTable
92
+ content={[
93
+ {
94
+ name: 'version',
95
+ type: '2',
96
+ description: 'Version of the serializable batch reference.',
97
+ },
98
+ {
99
+ name: 'id',
100
+ type: 'string',
101
+ description: 'Provider batch identifier.',
102
+ },
103
+ {
104
+ name: 'provider',
105
+ type: 'string',
106
+ description: 'Provider identifier for the batch.',
107
+ },
108
+ {
109
+ name: 'status',
110
+ type: "'pending' | 'completed' | 'failed'",
111
+ description: 'Initial normalized batch status.',
112
+ },
113
+ {
114
+ name: 'rawStatus',
115
+ type: 'string',
116
+ isOptional: true,
117
+ description: 'The provider-specific batch status, when available.',
118
+ },
119
+ {
120
+ name: 'requestCounts',
121
+ type: '{ total: number; pending: number; completed: number; failed: number }',
122
+ isOptional: true,
123
+ description: 'Provider-reported request counts.',
124
+ },
125
+ {
126
+ name: 'error',
127
+ type: 'Experimental_BatchError',
128
+ isOptional: true,
129
+ description: 'Error details when the batch fails.',
130
+ },
131
+ {
132
+ name: 'createdAt',
133
+ type: 'string',
134
+ isOptional: true,
135
+ description: 'Creation timestamp, when provided by the provider.',
136
+ },
137
+ {
138
+ name: 'expiresAt',
139
+ type: 'string',
140
+ isOptional: true,
141
+ description: 'Expiration timestamp, when provided by the provider.',
142
+ },
143
+ {
144
+ name: 'providerMetadata',
145
+ type: 'ProviderMetadata',
146
+ isOptional: true,
147
+ description: 'Provider-specific metadata for the batch.',
148
+ },
149
+ {
150
+ name: 'warnings',
151
+ type: 'Warning[]',
152
+ description: 'Warnings returned while starting the batch.',
153
+ },
154
+ ]}
155
+ />