Chrome Prompt API Reference Complete implementation guide for Chrome's built-in Prompt API using Gemini Nano. Hardware & OS Requirements OS: Windows 10/11, macOS 13+ (Ventura+), Linux, ChromeOS (Platform 16389.0.0+) on Chromebook Plus Storage: 22 GB free (model downloaded separately) GPU: 4 GB VRAM OR CPU: 16 GB RAM + 4 cores Network: Unmetered connection for download Chrome: 138+ (Extensions in stable, Web in origin trial) Not supported: Mobile (Android, iOS), non-Chromebook Plus ChromeOS Check model size: Model removed if storage <10 GB after download. Language Support From Chrome 140: Engl…

to ensure valid hashtag format\",\n \"• Use session.prompt() with responseConstraint parameter\",\n \"• Model returns valid JSON you can parse safely\",\n \"• Use omitResponseConstraintInput to exclude schema from quota\"\n ]\n },\n {\n \"input\": \"How can I preserve conversation context across page refreshes?\",\n \"output\": [\n \"• Store initialPrompts array and session parameters in localStorage\",\n \"• On page load, retrieve stored data and pass to LanguageModel.create()\",\n \"• Track user and assistant messages after each prompt\",\n \"• Append new messages to initialPrompts array\",\n \"• Save updated conversation history to localStorage\"\n ]\n }\n ],\n \"best_practices\": [\n \"Keep one empty session alive to prevent model unloading and reloading delays\",\n \"Use AbortController with signal parameter to let users cancel long-running generations\",\n \"Clone sessions instead of recreating when you need parallel conversations with shared context\"\n ],\n \"anti_patterns\": [\n \"Creating new sessions for every request instead of reusing (model reload is expensive)\",\n \"Ignoring inputUsage and inputQuota limits until the session fails\",\n \"Assuming the Prompt API is available without checking before creating sessions\"\n ],\n \"faq\": [\n {\n \"question\": \"What Chrome version supports the Prompt API?\",\n \"answer\": \"Chrome 138+ for extensions in stable channel. Web apps require origin trial registration. Check chrome://on-device-internals for model status.\"\n },\n {\n \"question\": \"How much storage does Gemini Nano require?\",\n \"answer\": \"The model needs 22 GB free storage for download. Chrome automatically removes it if available storage drops below 10 GB after installation.\"\n },\n {\n \"question\": \"Can I use this API in Chrome extensions?\",\n \"answer\": \"Yes. The Prompt API is available in Chrome 138+ stable for extensions without origin trial permissions. Remove expired aiLanguageModelOriginTrial permission.\"\n },\n {\n \"question\": \"Is my data sent to external servers when using Gemini Nano?\",\n \"answer\": \"No. Gemini Nano runs completely on-device. All processing happens locally in the browser without any external network requests.\"\n },\n {\n \"question\": \"Why is the model unavailable even with Chrome 138 installed?\",\n \"answer\": \"Check: 22 GB free storage, 4+ GB GPU VRAM or 16 GB RAM, supported OS version, and enable chrome://flags/#prompt-api-for-gemini-nano-multimodal-input.\"\n },\n {\n \"question\": \"How does on-device AI compare to cloud APIs like Claude?\",\n \"answer\": \"On-device offers privacy and zero latency but smaller context windows and less capability. Best for privacy-sensitive or offline scenarios.\"\n }\n ]\n },\n \"file_structure\": [\n {\n \"name\": \"SKILL.md\",\n \"type\": \"file\",\n \"path\": \"SKILL.md\",\n \"lines\": 452\n }\n ]\n}\n","content_type":"application/json; charset=utf-8","language":"json","size":17285,"content_sha256":"ef0963c3321667ad17c75c78c3e830736796a532545982025395ebb5fedbdaa2"}],"content_json":{"type":"doc","content":[{"type":"heading","attrs":{"level":1},"content":[{"text":"Chrome Prompt API Reference","type":"text"}]},{"type":"paragraph","content":[{"text":"Complete implementation guide for Chrome's built-in Prompt API using Gemini Nano.","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Hardware & OS Requirements","type":"text"}]},{"type":"paragraph","content":[{"text":"OS:","type":"text","marks":[{"type":"strong"}]},{"text":" Windows 10/11, macOS 13+ (Ventura+), Linux, ChromeOS (Platform 16389.0.0+) on Chromebook Plus ","type":"text"},{"text":"Storage:","type":"text","marks":[{"type":"strong"}]},{"text":" 22 GB free (model downloaded separately) ","type":"text"},{"text":"GPU:","type":"text","marks":[{"type":"strong"}]},{"text":" >4 GB VRAM OR ","type":"text"},{"text":"CPU:","type":"text","marks":[{"type":"strong"}]},{"text":" 16 GB RAM + 4 cores ","type":"text"},{"text":"Network:","type":"text","marks":[{"type":"strong"}]},{"text":" Unmetered connection for download ","type":"text"},{"text":"Chrome:","type":"text","marks":[{"type":"strong"}]},{"text":" 138+ (Extensions in stable, Web in origin trial)","type":"text"}]},{"type":"paragraph","content":[{"text":"Not supported:","type":"text","marks":[{"type":"strong"}]},{"text":" Mobile (Android, iOS), non-Chromebook Plus ChromeOS","type":"text"}]},{"type":"paragraph","content":[{"text":"Check model size: ","type":"text"},{"text":"chrome://on-device-internals","type":"text","marks":[{"type":"code_inline"}]},{"text":" Model removed if storage \u003c10 GB after download.","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Language Support","type":"text"}]},{"type":"paragraph","content":[{"text":"From Chrome 140: English, Spanish, Japanese (input/output)","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Availability Check","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"javascript"},"content":[{"text":"const availability = await LanguageModel.availability();\n// Returns: \"unavailable\" | \"downloadable\" | \"downloading\" | \"available\"","type":"text"}]},{"type":"paragraph","content":[{"text":"CRITICAL:","type":"text","marks":[{"type":"strong"}]},{"text":" Always pass same options to ","type":"text"},{"text":"availability()","type":"text","marks":[{"type":"code_inline"}]},{"text":" as you use in ","type":"text"},{"text":"create()","type":"text","marks":[{"type":"code_inline"}]},{"text":". Some models don't support certain modalities/languages.","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Model Parameters","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"javascript"},"content":[{"text":"await LanguageModel.params();\n// { defaultTopK: 3, maxTopK: 128, defaultTemperature: 1, maxTemperature: 2 }","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Session Creation","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Basic Session","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"javascript"},"content":[{"text":"const session = await LanguageModel.create();","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"With Custom Parameters","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"javascript"},"content":[{"text":"const params = await LanguageModel.params();\nconst session = await LanguageModel.create({\n temperature: Math.min(params.defaultTemperature * 1.2, 2.0),\n topK: params.defaultTopK\n});","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"With Download Monitoring","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"javascript"},"content":[{"text":"const session = await LanguageModel.create({\n monitor(m) {\n m.addEventListener('downloadprogress', (e) => {\n console.log(`Downloaded ${e.loaded * 100}%`);\n });\n }\n});","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"With AbortSignal","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"javascript"},"content":[{"text":"const controller = new AbortController();\nstopButton.onclick = () => controller.abort();\n\nconst session = await LanguageModel.create({\n signal: controller.signal\n});","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Initial Prompts (Context Setting)","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"javascript"},"content":[{"text":"const session = await LanguageModel.create({\n initialPrompts: [\n { role: 'system', content: 'You are a helpful assistant.' },\n { role: 'user', content: 'What is the capital of Italy?' },\n { role: 'assistant', content: 'The capital of Italy is Rome.' },\n { role: 'user', content: 'What language is spoken there?' },\n { role: 'assistant', content: 'The official language is Italian.' }\n ]\n});","type":"text"}]},{"type":"paragraph","content":[{"text":"Use cases:","type":"text","marks":[{"type":"strong"}]}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Resume stored sessions after browser restart","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"N-shot prompting","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Set assistant personality/tone","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Provide conversation history","type":"text"}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Multimodal Input (Origin Trial)","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"expectedInputs & expectedOutputs","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"javascript"},"content":[{"text":"const session = await LanguageModel.create({\n expectedInputs: [\n {\n type: \"text\", // or \"image\", \"audio\"\n languages: [\"en\" /* system */, \"ja\" /* user prompt */]\n }\n ],\n expectedOutputs: [\n { type: \"text\", languages: [\"ja\"] }\n ]\n});","type":"text"}]},{"type":"paragraph","content":[{"text":"Input types:","type":"text","marks":[{"type":"strong"}]},{"text":" text, image, audio ","type":"text"},{"text":"Output types:","type":"text","marks":[{"type":"strong"}]},{"text":" text only","type":"text"}]},{"type":"paragraph","content":[{"text":"Throws ","type":"text"},{"text":"NotSupportedError","type":"text","marks":[{"type":"code_inline"}]},{"text":" if unsupported modality.","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Using with Images/Audio","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"javascript"},"content":[{"text":"const session = await LanguageModel.create({\n initialPrompts: [{\n role: 'system',\n content: 'Analyze images for patterns.'\n }],\n expectedInputs: [{ type: 'image' }]\n});\n\n// Append image\nawait session.append([{\n role: 'user',\n content: [\n { type: 'text', value: 'Analyze this image' },\n { type: 'image', value: fileInput.files[0] }\n ]\n}]);","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Prompting Methods","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Non-Streaming (Short Responses)","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"javascript"},"content":[{"text":"const result = await session.prompt('Write me a haiku!');\nconsole.log(result);","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Streaming (Long Responses)","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"javascript"},"content":[{"text":"const stream = session.promptStreaming('Write me a long poem!');\nfor await (const chunk of stream) {\n console.log(chunk); // Partial results as they arrive\n}","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"With AbortSignal","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"javascript"},"content":[{"text":"const controller = new AbortController();\nstopButton.onclick = () => controller.abort();\n\nconst result = await session.prompt('Write a poem', {\n signal: controller.signal\n});","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Response Constraints (Structured Output)","type":"text"}]},{"type":"paragraph","content":[{"text":"Pass JSON Schema to get predictable JSON responses:","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"javascript"},"content":[{"text":"const schema = {\n type: \"object\",\n properties: {\n hashtags: {\n type: \"array\",\n maxItems: 3,\n items: {\n type: \"string\",\n pattern: \"^#[^\\\\s#]+$\"\n }\n }\n },\n required: [\"hashtags\"],\n additionalProperties: false\n};\n\nconst result = await session.prompt(\n `Generate hashtags for: ${post}`,\n { responseConstraint: schema }\n);\n\nconst data = JSON.parse(result); // Guaranteed valid JSON","type":"text"}]},{"type":"paragraph","content":[{"text":"Simple boolean example:","type":"text","marks":[{"type":"strong"}]}]},{"type":"code_block","attrs":{"wrap":false,"language":"javascript"},"content":[{"text":"const schema = { \"type\": \"boolean\" };\nconst result = await session.prompt(\n `Is this about pottery?\\n\\n${text}`,\n { responseConstraint: schema }\n);\nconsole.log(JSON.parse(result)); // true or false","type":"text"}]},{"type":"paragraph","content":[{"text":"Measure input quota usage:","type":"text","marks":[{"type":"strong"}]}]},{"type":"code_block","attrs":{"wrap":false,"language":"javascript"},"content":[{"text":"const usage = session.measureInputUsage({ responseConstraint: schema });","type":"text"}]},{"type":"paragraph","content":[{"text":"Omit schema from input quota:","type":"text","marks":[{"type":"strong"}]}]},{"type":"code_block","attrs":{"wrap":false,"language":"javascript"},"content":[{"text":"const result = await session.prompt(\n `Summarize as JSON { rating } with 0-5 number:`,\n {\n responseConstraint: schema,\n omitResponseConstraintInput: true\n }\n);","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Response Prefixes","type":"text"}]},{"type":"paragraph","content":[{"text":"Guide model output format by prefilling assistant response:","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"javascript"},"content":[{"text":"const result = await session.prompt([\n { role: 'user', content: 'Create a TOML character sheet' },\n { role: 'assistant', content: '```toml\\n', prefix: true }\n]);\n// Model continues from \"```toml\\n\"","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"append() Method","type":"text"}]},{"type":"paragraph","content":[{"text":"Add messages to session without immediate response (useful for multimodal):","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"javascript"},"content":[{"text":"await session.append([\n {\n role: 'user',\n content: [\n { type: 'text', value: 'First context message' },\n { type: 'image', value: imageFile }\n ]\n }\n]);\n\n// Later, prompt with accumulated context\nconst result = await session.prompt('Analyze the images');","type":"text"}]},{"type":"paragraph","content":[{"text":"Promise fulfills when validated and appended.","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Session Management","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Check Quota","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"javascript"},"content":[{"text":"console.log(`${session.inputUsage}/${session.inputQuota}`);\nconst remaining = session.inputQuota - session.inputUsage;","type":"text"}]},{"type":"paragraph","content":[{"text":"When quota exceeded, oldest messages lost from context.","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Clone Session","type":"text"}]},{"type":"paragraph","content":[{"text":"Clones inherit parameters, initial prompts, and history:","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"javascript"},"content":[{"text":"const mainSession = await LanguageModel.create({\n initialPrompts: [{ role: 'system', content: 'Speak like a pirate' }]\n});\n\nconst clone1 = await mainSession.clone();\nconst clone2 = await mainSession.clone({ signal: controller.signal });\n\n// Independent conversations with same setup\nawait clone1.prompt('Tell me a joke about parrots');\nawait clone2.prompt('Tell me a joke about treasure');","type":"text"}]},{"type":"paragraph","content":[{"text":"Use for:","type":"text","marks":[{"type":"strong"}]},{"text":" Parallel conversations, \"what if\" scenarios, resource efficiency","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Restore Session from localStorage","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"javascript"},"content":[{"text":"let sessionData = getFromLocalStorage(uuid) || {\n initialPrompts: [],\n topK: (await LanguageModel.params()).defaultTopK,\n temperature: (await LanguageModel.params()).defaultTemperature\n};\n\nconst session = await LanguageModel.create(sessionData);\n\n// Track conversation\nconst stream = session.promptStreaming(prompt);\nlet result = '';\nfor await (const chunk of stream) {\n result = chunk;\n}\n\nsessionData.initialPrompts.push(\n { role: 'user', content: prompt },\n { role: 'assistant', content: result }\n);\n\nlocalStorage.setItem(uuid, JSON.stringify(sessionData));","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Destroy Session","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"javascript"},"content":[{"text":"session.destroy();\n// Frees resources, aborts ongoing execution\n// Session unusable after destroy","type":"text"}]},{"type":"paragraph","content":[{"text":"Best practice:","type":"text","marks":[{"type":"strong"}]},{"text":" Keep one empty session alive to keep model loaded. Destroy only when truly done.","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"User Activation Requirement","type":"text"}]},{"type":"paragraph","content":[{"text":"Model download requires user interaction:","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"javascript"},"content":[{"text":"if (navigator.userActivation.isActive) {\n const session = await LanguageModel.create();\n}","type":"text"}]},{"type":"paragraph","content":[{"text":"Sticky activation events:","type":"text","marks":[{"type":"strong"}]},{"text":" click, tap, keydown, mousedown","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Permission Policy & iframes","type":"text"}]},{"type":"paragraph","content":[{"text":"Default:","type":"text","marks":[{"type":"strong"}]},{"text":" Top-level windows + same-origin iframes only","type":"text"}]},{"type":"paragraph","content":[{"text":"Grant cross-origin iframe access:","type":"text","marks":[{"type":"strong"}]}]},{"type":"code_block","attrs":{"wrap":false,"language":"html"},"content":[{"text":"\u003ciframe src=\"https://cross-origin.example.com/\"\n allow=\"language-model\">\n\u003c/iframe>","type":"text"}]},{"type":"paragraph","content":[{"text":"Not available in Web Workers","type":"text","marks":[{"type":"strong"}]},{"text":" (permission policy complexity)","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Local Development (localhost)","type":"text"}]},{"type":"ordered_list","attrs":{"order":1,"listStyle":"number"},"content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Go to ","type":"text"},{"text":"chrome://flags/#prompt-api-for-gemini-nano-multimodal-input","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Select ","type":"text"},{"text":"Enabled","type":"text","marks":[{"type":"strong"}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Relaunch Chrome","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Open DevTools, type: ","type":"text"},{"text":"await LanguageModel.availability();","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Should return ","type":"text"},{"text":"\"available\"","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"paragraph","content":[{"text":"Troubleshoot:","type":"text","marks":[{"type":"strong"}]}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Restart Chrome","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Check ","type":"text"},{"text":"chrome://on-device-internals","type":"text","marks":[{"type":"code_inline"}]},{"text":" → Model Status tab","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Wait for model download to complete","type":"text"}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Chrome Extensions","type":"text"}]},{"type":"paragraph","content":[{"text":"Available in Chrome 138+ stable for extensions.","type":"text"}]},{"type":"paragraph","content":[{"text":"Remove expired origin trial permissions:","type":"text","marks":[{"type":"strong"}]}]},{"type":"code_block","attrs":{"wrap":false,"language":"json"},"content":[{"text":"{\n \"permissions\": [\"aiLanguageModelOriginTrial\"] // REMOVE THIS\n}","type":"text"}]},{"type":"paragraph","content":[{"text":"Register for current origin trial if needed.","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Best Practices","type":"text"}]},{"type":"paragraph","content":[{"text":"Session management:","type":"text","marks":[{"type":"strong"}]}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Clone sessions to preserve initial prompts","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Use AbortController to let users stop responses","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Track inputUsage to warn before quota exceeded","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Destroy unused sessions to free memory","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Keep one empty session alive to keep model ready","type":"text"}]}]}]},{"type":"paragraph","content":[{"text":"Performance:","type":"text","marks":[{"type":"strong"}]}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Use streaming for long responses","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"append() messages in advance for multimodal","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Monitor download progress, inform users","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Check availability before creating sessions","type":"text"}]}]}]},{"type":"paragraph","content":[{"text":"Structured output:","type":"text","marks":[{"type":"strong"}]}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Use JSON Schema for predictable responses","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"LLMs good at generating schemas from descriptions","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Validate with JSON Schema validators","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Use prefix for format guidance","type":"text"}]}]}]},{"type":"paragraph","content":[{"text":"Context preservation:","type":"text","marks":[{"type":"strong"}]}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Store conversation in localStorage for restoration","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Use initialPrompts for session context","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Clone for parallel conversations with same context","type":"text"}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Error Handling","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"javascript"},"content":[{"text":"try {\n const session = await LanguageModel.create();\n const result = await session.prompt('Hello');\n} catch (err) {\n if (err.name === 'AbortError') {\n // User stopped generation\n } else if (err.name === 'NotSupportedError') {\n // Unsupported modality/language\n } else {\n console.error(err.name, err.message);\n }\n}","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Key Limitations","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Desktop only (no mobile)","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"22 GB storage required","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Unmetered network for download","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"No Web Workers support","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Output is text-only (input can be multimodal)","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Context window has token limits","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Model removed if storage \u003c10 GB after download","type":"text"}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Use Cases","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"AI-powered search on page content","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Content classification/filtering","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Event extraction from pages","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Contact information extraction","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Chatbots with conversation memory","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Offline AI features","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Privacy-sensitive data processing","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Content summarization","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Translation assistance","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Image/audio analysis (multimodal)","type":"text"}]}]}]},{"type":"hr","attrs":{"markup":"---"}}]},"metadata":{"date":"2026-06-05","name":"web-ai-prompt-api","author":"@skillopedia","source":{"stars":336,"repo_name":"marketplace","origin_url":"https://github.com/aiskillstore/marketplace/blob/HEAD/skills/ajv009/web-ai-prompt-api/SKILL.md","repo_owner":"aiskillstore","body_sha256":"3658215e8de62698efa2762f1330e30e163f9afc06ce1d81128cc99043fc6c20","cluster_key":"fa7272ed68a22f65fbc32edca22d2c5de252b8dea83534f1153f25227ee3743f","clean_bundle":{"format":"clean-skill-bundle-v1","source":"aiskillstore/marketplace/skills/ajv009/web-ai-prompt-api/SKILL.md","attachments":[{"id":"35bce238-610c-5040-a7b6-0dd13f77dcb4","key":"uploads/10433ee7-ad12-4ae0-b34e-97553e46c6c8/35bce238-610c-5040-a7b6-0dd13f77dcb4/attachment.json","path":"skill-report.json","size":17285,"sha256":"ef0963c3321667ad17c75c78c3e830736796a532545982025395ebb5fedbdaa2","contentType":"application/json; charset=utf-8"}],"bundle_sha256":"e7321b6598ae0e50ff096b1067976b01454e0c2b2c90e65752a243131e24de6f","attachment_count":1,"text_attachments":1,"attachment_storage":"skillopedia-attachments-v1","binary_attachments":0,"excluded_attachments":[]},"cluster_size":1,"skill_md_path":"skills/ajv009/web-ai-prompt-api/SKILL.md","import_metadata":{"date":"2026-06-05","author":"@skillopedia","version":"v1","category":"browser-automation-scraping","category_label":"Browser"},"exact_dupes_collapsed_into_this":0},"version":"v1","category":"browser-automation-scraping","import_tag":"clean-skills-v1","description":"Chrome's built-in Prompt API implementation guide. Use Gemini Nano locally in browser for AI features - session management, multimodal input, structured output, streaming, Chrome Extensions. Reference for all Prompt API development."}},"renderedAt":1782987778387}

Chrome Prompt API Reference Complete implementation guide for Chrome's built-in Prompt API using Gemini Nano. Hardware & OS Requirements OS: Windows 10/11, macOS 13+ (Ventura+), Linux, ChromeOS (Platform 16389.0.0+) on Chromebook Plus Storage: 22 GB free (model downloaded separately) GPU: 4 GB VRAM OR CPU: 16 GB RAM + 4 cores Network: Unmetered connection for download Chrome: 138+ (Extensions in stable, Web in origin trial) Not supported: Mobile (Android, iOS), non-Chromebook Plus ChromeOS Check model size: Model removed if storage <10 GB after download. Language Support From Chrome 140: Engl…