Sanvaya is an open source (Apache-2.0) server that sits between your applications and AI providers. You run it yourself, with your own provider keys. It is an alpha.
This post covers what is built, what has been tried, what has not, and two gaps I closed this week.
What it does today
Chat completions, with and without streaming, and embeddings. These work with OpenAI, OpenAI-compatible servers, Anthropic and Google Gemini.
Model aliases with retries, fallback and time limits. A fallback sends your prompt to the next provider, and retries can be billed twice.
Spend records and budgets per client key, team and route. Prices are what you configure, and Sanvaya never marks up tokens. A hard budget is not an exact cap, because cost is estimated before each call.
An opt-in exact-match cache, kept separate for each team, in a SQLite file. Cached answers are stored unredacted.
Agent Passports, which record what an agent did, and passport verify, which checks them. The seal is an unkeyed hash chain, not a signature, so a Passport does not prove who acted.
Agent runs, in paper or simulation mode. Every tool call goes through a gate: a grant, a policy, and a person's approval typed in a terminal when the policy asks for one.
Nothing listens beyond the local machine unless a person approves it at a terminal. This guards against accidents. It does not stop a program running as your user, and it does not control firewalls or tunnels.
Try it
It is on PyPI as a pre-release:
pip install --pre sanvaya
To read or change the code, run it from source. You need Python 3.11 or later and uv.
git clone https://github.com/anilatambharii/sanvaya.git
cd sanvaya
uv sync
export OPENAI_API_KEY=placeholder # enough to start; a real key is needed to get answers
uv run sanvaya check --config examples/sanvaya.yaml
uv run sanvaya up --config examples/sanvaya.yaml
In another terminal:
curl http://127.0.0.1:8080/healthz
curl http://127.0.0.1:8080/v1/models
You should see {"status":"ok"} and a list with one model. check does not contact a provider, so a placeholder key passes it. A real call needs a real key and a real model name in place of replace-with-a-model-name in the example config.
What has been tried
Automated tests: 1174 passed and 3 skipped on 2026-12-04, on Windows with Python 3.13. CI runs on Linux and Windows. Almost all of these tests use simulated providers.
Anthropic, live: 14 of 14 checks with Haiku 5.5 and Sonnet 5.5, on 2026-12-02.
Gemini, live: 14 of 14 checks with gemini-3.5-flash-lite on a free-tier key, on 2026-12-03.
A local Ollama server through the openai_compatible type: 8 of 8 checks, on 2026-12-03. One server and a tiny model, and no agent runs.
So it has been briefly tried live against Anthropic, Gemini and Ollama, for one day each.
What has not
OpenAI itself. It is untested live.
Any real app or IDE. The OpenAI Python SDK was tried against simulated providers.
Approving and resuming an agent run with a live model. That step was tested with a simulated model.
Rate limiting. There is none, and many addresses together can still fill the server. That is the largest known gap.
A human review. Four reviews have been done so far, all by AI agents, none independent. No person other than me has reviewed the code.

Live tests ran for one day each. Almost all automated tests use simulated providers.
Gap 1: no read timeout
How I found it. The third AI review listed the missing read timeout as open. The fourth AI review rated it Medium. So I fixed it.
The fix. A client that sends a request too slowly is now cut off with a 408:
20 seconds for the headers.
120 seconds for the body.
Over the next releases I added limits on connections and clients:
Open connections are capped at 1000 in all, and 100 for each address, except behind a proxy.
A client that stops reading is dropped after 60 seconds.
A client key may cap its running requests.
All of these are settable. The time limits and connection caps are tested with real sockets on loopback. The per-key request cap is tested with a fake application.
Still open: there is no rate limit, and many addresses together can still fill the server. If others can reach your server, put a proxy with limits in front of it.

If the headers do not arrive within 20 seconds, or the body within 120 seconds, Sanvaya closes the connection with a 408. Also added: connection caps, a 60 second drop for clients that stop reading, and an optional per-key request cap
Gap 2: a provider key in an answer
Sanvaya already hid the provider key in error messages. It did not check successful answers, so a provider that put the key in one would have had it passed to the client.
The fix. A provider answer or stream event that holds the provider key is dropped, and the client gets the error upstream_leaked_key. Sanvaya looks for the key as it is, URL-encoded, JSON-escaped and in base64.
Still open: a key altered in other ways, such as reversed, split or in hexadecimal, is passed on. This was tested against simulated providers.
What I took from this
The read timeout stayed on a written list across two reviews until it was fixed.
Sanvaya is an alpha. Changes can break between 0.x releases, and it is not for production. Four AI reviews and no independent human review so far. Code, issues and the threat model are here: https://github.com/anilatambharii/sanvaya
About the author
I'm Anil Prasad, Chief AI Architect and founder of Ambharii Labs. I have spent [25 or 28] years in AI, ML and data, mostly in regulated industries: healthcare, life sciences, energy and financial services. I build Sanvaya and Keelgate in the open, and I write each week about what works in production AI, what breaks, and what is still unproven.
If you try Sanvaya and something breaks, open an issue. For anything security related, please use the private reporting in SECURITY.md instead of a public issue.

