AI SDK ErrorsAI_APICallError
AI_APICallError
This error occurs when an API call fails.
Properties
url
: The URL of the API request that failedrequestBodyValues
: The request body values sent to the APIstatusCode
: The HTTP status code returned by the APIresponseHeaders
: The response headers returned by the APIresponseBody
: The response body returned by the APIisRetryable
: Whether the request can be retried based on the status codedata
: Any additional data associated with the error
Checking for this Error
You can check if an error is an instance of AI_APICallError
using:
import { APICallError } from 'ai';
if (APICallError.isInstance(error)) { // Handle the error}