Inside SpectraLens AI: Architecture for Multi-Engine Browser AI with Zero API Costs
When building research workflows with LLMs, switching between different model interfaces is frustrating and disjointed. Commercial API keys are expensive for personal experimentation, while web chat interfaces are isolated in separate tabs.
With SpectraLens AI, I wanted to answer a practical engineering question:
Can we execute parallel multi-model queries directly inside any active webpage by orchestrating existing browser sessions with zero API token overhead?
1. The Multi-Model Session Gateway
Rather than requiring users to maintain paid third-party API subscriptions, SpectraLens AI communicates directly with active session endpoints.
Key Architectural Challenges:
- Manifest V3 Worker Constraints: Background service workers in Manifest V3 are ephemeral and can terminate unexpectedly during long streaming responses.
- CORS & Session Token Handling: Ensuring session authorization cookies are forwarded cleanly without compromising user security.
- DOM Content Extraction: Parsing arbitrary HTML structures into clean Markdown formatted inputs for prompt assembly.
2. On-Device OCR with WebAssembly
To capture text from non-selectable web graphics or video frames, SpectraLens integrates an offline Tesseract.js WebAssembly build. Text extraction happens 100% locally on the client without uploading screenshots to external servers.
3. Key Takeaways
- Browser extensions can act as powerful personal orchestration layers.
- Local-first WebAssembly pipelines give users privacy without server hosting bills.
- Designing with strict Manifest V3 lifecycle constraints creates resilient, memory-efficient software.