Developer describes in-browser LLM router with encrypted IndexedDB API keys

aifoc.us15 min read

The author built an experimental in-browser AI router using the MessageChannel API and Web Crypto primitives to let client-side web applications call large language models without exposing API keys or requiring a dedicated backend proxy. The system stores encrypted keys in a partitioned IndexedDB on a trusted origin and passes bounded MessagePorts to untrusted host pages to handle streaming completions and coding agent loops securely. Open article →