Chrome extension/AI/Working
Developer AI Sidebar
A chat sidebar on every website that streams answers from cloud or local LLMs, using your own API keys.
§ 01
What it is
A chat panel that slides in over whatever page you are on. You add your own API key - or point it at a model running on your own machine - and ask about the page without switching tabs. Chats, saved prompts and settings stay in the browser.
The problem
Asking an AI about the page in front of you usually means copying text into another tab and pasting the answer back, losing the context each time. Most AI extensions also tie you to one provider.
Runtime
- SidebarReact in a Shadow DOM
- Stream portchrome.runtime.connect
- Service workerfetch · SSE parser
- Providers10 presets, cloud + local
§ 02
Screenshot

Real screenshots of the extension's own interface; some show sample content.
§ 03
How it works
- 01
Press Cmd/Ctrl+Shift+A or click the toolbar icon. The sidebar opens, and the open state is shared with every tab.
- 02
Ask a question, attach files, or pull in the page text or your current selection as context.
- 03
The command palette (Cmd/Ctrl+Shift+P) has developer actions - explain code, find bugs, generate tests, convert JavaScript to TypeScript, explain a stack trace - that send the selection or the page's code blocks with a written prompt.
- 04
The reply streams in as it is generated, rendered as Markdown with highlighted code and math. Stop, regenerate or copy it with a shortcut.
- 05
Right-click selected text and choose "Explain with Developer AI" to open the sidebar with that text.
§ 04
Architecture
- 01
Content script
Mounts the React app inside a Shadow DOM root with its stylesheet inlined, so the page's CSS and the sidebar's CSS cannot affect each other.
- 02
Service worker
Makes every model request. Each generation opens a long-lived port; the worker reads the provider's server-sent events, forwards text chunks, and aborts the fetch through an AbortController when the user stops it.
- 03
Provider layer
One request builder per API shape - OpenAI-style chat completions, Anthropic messages and Gemini streamGenerateContent - behind ten presets, including OpenRouter, Groq, Mistral, DeepSeek, and Ollama and LM Studio on localhost.
- 04
Local storage
Dexie over IndexedDB: chats, messages indexed by chat and time, providers, prompts with a multi-entry tag index, and settings.
§ 05
Key features
- Works with ten provider presets or any OpenAI-compatible endpoint, including models running locally.
- Streaming replies with stop and regenerate.
- Page and selection context, file attachments, and a command palette of developer prompts.
- Searchable chat history and a prompt library with folders and tags (fuzzy search with Fuse.js).
- Markdown rendering with Shiki code highlighting and KaTeX math; long chats use a virtualized list.
- Keyboard shortcuts for opening, new chat, history, prompts, settings, copy and regenerate.
§ 06
Technical implementation
Requests leave from the service worker, not the page
The page's own CORS and CSP rules do not apply to the extension's service worker, and the request survives the sidebar re-rendering. It also leaves one place that owns cancellation.
One pipeline, three wire formats
The system prompt moves to where each API expects it: a top-level system field for Anthropic, systemInstruction for Gemini (which also calls the assistant "model"), and a normal message for everything OpenAI-compatible.
A small streaming parser
Chunks are buffered and split on blank lines; only data: lines are parsed, [DONE] is skipped, and malformed events are ignored instead of ending the stream.
§ 07
Permissions & browser APIs
- <all_urls>
- Shows the sidebar on any site and lets the worker call whichever provider URL you configure.
- scripting + activeTab
- Injects the sidebar into tabs that were already open when the extension was installed.
- tabs
- Sends the open/closed state to every open tab so the sidebar stays in sync.
- contextMenus
- Adds "Explain with Developer AI" for selected text.
- storage
- Remembers whether the sidebar is open.
§ 08
Hard parts & limits
- Keeping one open/closed state across every tab: the worker saves it to chrome.storage and messages each tab. Tabs opened before the install have no content script, so it is injected on demand and the message is retried until the script is listening.
- Each provider streams in its own event format, so the text is pulled out per provider before it reaches the UI.