Here is exactly why I built it, how it works under the hood, and the reality of using it.
The Problem
LLM APIs are expensive, and they go down a lot. OpenAI logged over 160 incidents in 9 months. When a critical AI dependency goes down, engineering teams just sit there. On top of that, every existing AI gateway on the market (like LiteLLM or Portkey) makes the same assumption: you have API keys and you are willing to pay per token. They just route your paid requests through another paid layer.
I did not want to pay per token, and I did not want to rely on their official API uptime.
How Mirage Works
Mirage bypasses the paid API layer entirely. It uses the exact same internal web APIs that power the chat interfaces you already use in your browser.
You just import your existing browser sessions. Mirage reads your cookies and localStorage from Chrome, Firefox, or Edge. It authenticates as you, and routes your code requests through those free internal endpoints. There is no middleman, no per-token billing, and no API key management.
Under the Hood
To make this work without getting blocked by anti-bot systems, Mirage has to look exactly like a real human using a real browser.
I wrote it in Rust. It uses a custom headless browser engine called Obscura. Obscura runs real JavaScript through V8, maintains a real DOM tree, and speaks the Chrome DevTools Protocol. More importantly, it presents real TLS and HTTP fingerprints so the providers think it is just a normal web browser. It is also about 12x faster and uses way less memory than standard headless Chrome.
Mirage keeps a pool of 10 warmed browser contexts in the background, each on its own OS thread. It has built-in circuit breakers, rate limiting, and exponential backoff so it does not spam the providers and get your account flagged.
What You Get
- One local endpoint (runs on
127.0.0.1:3000). - 75 models across 6 providers working right now (ChatGPT, DeepSeek, Gemini, Qwen, Mistral, Meta AI).
- A drop-in replacement for any OpenAI client. It works natively with LangChain, LlamaIndex, and OpenWebUI.
- Streaming, tool calling (via a custom Mirage Tool Protocol), web search, and file uploads.
- A single binary. No Docker, no Python, no Node.js required to run it. You just compile it and run it.
The Honest Catch
I need to be completely transparent about how this works. Because Mirage relies on internal web APIs, it is a cat-and-mouse game. The providers are massive companies with huge engineering teams. If they change their web UI or their internal wire format, the adapter will break until it is fixed.
This is not a "set it and forget it" tool. This is why I open-sourced it. I need a community of developers who can capture the new network formats when they change and submit pull requests. If you use Mirage, you are joining that maintenance loop.
How to run it
It is fully open source under the Apache 2.0 license.
Clone the repo, build it with cargo build --release, and run the binary. Point your OpenAI client to http://127.0.0.1:3000/v1 and start making requests.
If you are building with AI and are tired of API costs and rate limits, give it a look.
GitHub link: https://github.com/Sumama-Jameel/Mirage
Top comments (0)