API Reference
Complete API documentation for @built-in-ai/core with AI SDK v6
Provider Functions
builtInAI(modelId?, settings?)
Creates a browser AI model instance for chat.
Parameters:
modelId(optional): The model identifier, defaults to'text'settings(optional): Configuration optionstemperature?: number- Controls randomness (0-1)topK?: number- Limits vocabulary selection
Returns: BuiltInAIChatLanguageModel
builtInAI.textEmbedding(modelId, settings?)
Creates an embedding model instance.
Parameters:
modelId: Must be'embedding'settings(optional): Configuration optionswasmLoaderPath?: string- Path to WASM loader (default: CDN hosted)wasmBinaryPath?: string- Path to WASM binary (default: CDN hosted)modelAssetPath?: string- Path to model asset file (default: CDN hosted)l2Normalize?: boolean- Normalize with L2 norm (default: false)quantize?: boolean- Quantize embeddings to bytes (default: false)delegate?: 'CPU' | 'GPU'- Backend for inference
Returns: BuiltInAIEmbeddingModel
Utility Functions
doesBrowserSupportBuiltInAI()
Quick check if the browser supports the built-in AI API. Useful for component-level decisions and feature flags.
Returns: boolean - true if browser supports the Prompt API, false otherwise
Model Methods
BuiltInAIChatLanguageModel.availability()
Checks the current availability status of the built-in AI model.
Returns: Promise<"unavailable" | "downloadable" | "downloading" | "available">
| Status | Description |
|---|---|
"unavailable" | Model is not supported in the browser |
"downloadable" | Model is supported but needs to be downloaded first |
"downloading" | Model is currently being downloaded |
"available" | Model is ready to use |
BuiltInAIChatLanguageModel.createSessionWithProgress(onProgress?)
Creates a language model session with optional download progress monitoring.
Parameters:
onDownloadProgress?: (progress: number) => void- Optional callback that receives progress values from 0 to 1 during model download
Returns: Promise<LanguageModel> - The configured language model session
Types
BuiltInAIUIMessage
Extended UI message type for use with the useChat hook that includes custom data parts for built-in AI functionality.
type BuiltInAIUIMessage = UIMessage<
never,
{
modelDownloadProgress: {
status: "downloading" | "complete" | "error";
progress?: number;
message: string;
};
notification: {
message: string;
level: "info" | "warning" | "error";
};
}
>;