{"by":"kstonekuan","descendants":3,"id":44482710,"kids":[44484200,44486976],"score":33,"text":"Chrome now includes a native on-device LLM (Gemini Nano) starting in version 138. I&#x27;ve been building with it since it was in origin trials, it&#x27;s powerful but the official Prompt API is still a bit awkward:<p>- Enforces sessions even for basic usage<p>- Requires user-triggered downloads<p>- Lacks type safety or structured error handling<p>So I open-sourced a small TypeScript wrapper I originally built for other projects to smooth over the rough edges:<p>github: <a href=\"https:&#x2F;&#x2F;github.com&#x2F;kstonekuan&#x2F;simple-chromium-ai\">https:&#x2F;&#x2F;github.com&#x2F;kstonekuan&#x2F;simple-chromium-ai</a><p>npm: <a href=\"https:&#x2F;&#x2F;www.npmjs.com&#x2F;package&#x2F;simple-chromium-ai\" rel=\"nofollow\">https:&#x2F;&#x2F;www.npmjs.com&#x2F;package&#x2F;simple-chromium-ai</a><p>- Stateless prompt() method inspired by Anthropic&#x27;s SDK<p>- Built-in error handling and Result-based .Safe.* variants with neverthrow<p>- Token usage checks<p>- Simple initialization that provides a helper to trigger downloads (must be triggered by user action)<p>It’s intentionally minimal for hacking and prototyping. If you need fine-grained control (e.g. streaming, memory control), use the native API directly:<p><a href=\"https:&#x2F;&#x2F;developer.chrome.com&#x2F;docs&#x2F;ai&#x2F;prompt-api\" rel=\"nofollow\">https:&#x2F;&#x2F;developer.chrome.com&#x2F;docs&#x2F;ai&#x2F;prompt-api</a><p>Would love to hear what people build with it or any feedback!","time":1751824467,"title":"Show HN: Simple wrapper for Chrome's built-in local LLM (Gemini Nano)","type":"story","url":"https://github.com/kstonekuan/simple-chromium-ai"}