What problem does it solve?
Implements and debugs browser Prompt API integrations in JavaScript or TypeScript web apps. Use when adding LanguageModel availability checks, session creation, prompt or promptStreaming flows, structured output, download progress UX, or iframe permission-policy handling. Don't use for server-side LLM SDKs, REST AI APIs, or non-browser providers.
Core Features & Use Cases
- Availability checks with LanguageModel.availability() to determine support for given modalities and languages.
- Session creation via LanguageModel.create(), including initialPrompts and optional tools, with progress monitoring support.
- Prompt and promptStreaming flows, including structured output via responseConstraint and safe fallbacks for unsupported environments.
- Iframe and permissions-policy handling for cross-origin contexts, plus non-AI fallbacks when native APIs are unavailable.
Quick Start
Install or ensure the native Prompt API is available, then create a session and run a simple text prompt to validate integration.