experimental_cancelBatch
API Reference for experimental_cancelBatch.
Batch support is experimental and the API may change in patch releases.
Requests cancellation of an asynchronous batch. A successful call means that the provider accepted the cancellation request, not that cancellation has finished. For a complete guide to the batch lifecycle, see Batch.
Import
import { experimental_cancelBatch } from "ai"
API Signature
Parameters
provider?:
Experimental_BatchProvider
The provider used to access the batch. Defaults to the global provider, or the AI Gateway when no global provider is configured.
batch:
Experimental_BatchReference
The serializable reference returned by experimental_startBatch.
providerOptions?:
ProviderOptions
Additional provider-specific options for the cancellation request.
abortSignal?:
AbortSignal
An optional abort signal to cancel the API request.
timeout?:
number | { totalMs?: number }
Maximum time allowed for the cancellation request.
headers?:
Record<string, string | undefined>
Additional HTTP headers for the request.
Returns
providerMetadata?:
ProviderMetadata
Provider-specific metadata from the cancellation response.
Calling this function with a provider that does not support batch cancellation
throws an UnsupportedFunctionalityError.