Google has introduced the Prompt API, a new web API that allows developers to integrate Gemini Nano directly into Chrome applications. This built-in AI capability enables developers to create AI-powered features without requiring external API calls, potentially transforming how AI is implemented in web applications.
Google has quietly rolled out a significant addition to Chrome's developer toolkit with the Prompt API, a new interface that brings Gemini Nano directly into the browser environment. This development represents a notable shift in how AI capabilities might be delivered to web applications, potentially reducing dependency on external services and offering new possibilities for developers building on the Chrome platform.
The Prompt API allows developers to send natural language requests directly to Google's Gemini Nano model running within Chrome. This approach differs from traditional methods that require external API calls, potentially offering improved performance, reduced latency, and enhanced privacy by processing data on-device rather than sending it to external servers.
"The Prompt API opens up a range of possibilities for developers looking to integrate AI capabilities directly into their web applications," said Thomas Steiner and Alexandra Klepper, Chrome engineers who authored the documentation. "Features like AI-powered search, personalized content filtering, and automated data extraction can now be built with minimal external dependencies."
Practical Applications and Use Cases
The documentation outlines several compelling use cases for the Prompt API that demonstrate its potential impact:
- AI-powered search: Answering questions based on the content of a web page without leaving the site
- Personalized news feeds: Dynamically classifying articles with categories and allowing users to filter content
- Custom content filters: Automatically blurring or hiding content based on user-defined topics
- Calendar event creation: Extracting event details from web pages to create calendar entries
- Contact extraction: Pulling contact information from websites for easier business communication

Hardware Requirements and Limitations
The Prompt API comes with specific hardware requirements that developers and users should be aware of:
- Operating system: Windows 10 or 11, macOS 13+ (Ventura and onwards), Linux, or ChromeOS (from Platform 16389.0.0 and onwards) on Chromebook Plus devices
- Storage: At least 22 GB of free space on the volume containing the Chrome profile
- GPU or CPU: GPU requires strictly more than 4 GB of VRAM; CPU requires 16 GB of RAM or more and 4 CPU cores or more
- Network: Unlimited data or an unmetered connection
Notably, Chrome for Android, iOS, and ChromeOS on non-Chromebook Plus devices are not yet supported by APIs using Gemini Nano. The Prompt API with audio input specifically requires a GPU.
Technical Implementation Details
The Prompt API is designed with several technical features that make it powerful yet accessible to developers:
Model management: The Gemini Nano model is downloaded separately the first time an origin uses the API. Developers can check model availability with
LanguageModel.availability()and monitor download progress.Session management: Developers create sessions with
LanguageModel.create(), which can be customized with parameters like topK and temperature for Chrome Extensions. Sessions maintain conversation context until the context window is full.Multimodal support: The API supports multiple input types including text, images (as various image formats), and audio (as AudioBuffer, ArrayBufferView, or Blob). This enables richer interactions beyond simple text-based prompts.
Structured output: Developers can pass JSON schemas to constrain responses, ensuring outputs match expected formats. This is particularly useful for applications requiring specific data structures.
Streaming responses: The API offers both synchronous (
prompt()) and asynchronous (promptStreaming()) response methods, allowing developers to choose between waiting for complete responses or processing partial results as they arrive.
Developer Experience and Best Practices
The Prompt API documentation emphasizes several best practices for developers:
Context management: Sessions track conversation history, but when the context window overflows, the system removes earlier prompts and responses (except system prompts) to make room for new inputs.
Resource management: Developers can clone sessions to preserve conversation context while creating new interaction branches, and should terminate sessions with
destroy()when no longer needed to free resources.Error handling: The API includes specific exceptions like QuotaExceededError when context limits are reached and NotSupportedError for unsupported input or output modalities.
Privacy and Security Considerations
By processing AI requests on-device rather than sending them to external servers, the Prompt API offers potential privacy benefits. User data remains within the browser, reducing exposure to external services. However, developers should still acknowledge Google's Generative AI Prohibited Uses Policy and implement appropriate safeguards for sensitive applications.
Future Potential and Roadmap
The Prompt API is part of Chrome's broader initiative to integrate AI capabilities directly into the browser. As the API evolves, we can expect:
- Support for additional languages beyond the current English, Japanese, and Spanish
- Enhanced multimodal capabilities with more input types
- Improved performance optimization for various hardware configurations
- Potential expansion to mobile platforms
Getting Started with the Prompt API
For developers interested in experimenting with the Prompt API:
- Enable the required Chrome flags:
chrome://flags/#optimization-guide-on-device-modelandchrome://flags/#prompt-api-for-gemini-nano-multimodal-input - Review the hardware requirements to ensure compatibility
- Explore the available demos including the Prompt API playground, Mediarecorder Audio Prompt, and Canvas Image Prompt
- Test the API on localhost before implementing in production
- Join the early preview program to provide feedback and influence future development
The Prompt API represents a significant step toward making AI capabilities more accessible to web developers while potentially reducing reliance on external services. As Chrome continues to evolve its built-in AI offerings, we may see a shift in how AI-powered features are designed and implemented across the web.
For developers looking to dive deeper, the official documentation provides comprehensive examples and implementation details. The Chrome team has also made source code for demo extensions available on GitHub for further exploration.
Learn more about the Prompt API in the official Chrome for Developers documentation.

Comments
Please log in or register to join the discussion