This release is a pre-release and may not be stable for production use.
Sanvaya
A self-hosted, open source control layer for AI models, by Ambharii Labs. Built on Keelgate.
Alpha, under development. Tried live against Anthropic, Gemini and one local Ollama server, on one day each. OpenAI itself and other servers are untested. No one other than its author has reviewed the code. Do not use it in production. See live tests and status.
What works today
sanvaya checkvalidates the configuration and finds every secret without printing it.sanvaya upstarts a server withGET /healthzandGET /v1/models.sanvaya models checkasks each provider for its models, and names the ones in your configuration that it does not list. It contacts the providers, and so is not part ofcheck. Tested against simulated providers only.- Chat completions (with and without streaming) and embeddings for OpenAI, OpenAI-compatible servers, Anthropic and Google Gemini, with your own provider keys. Tested with the OpenAI Python SDK (version 3.60.0) against simulated providers, and briefly against live Anthropic, Gemini and Ollama only (live tests).
- Model aliases with retries, fallback and time limits. Only failures that may pass are retried. A fallback sends your prompt to the next provider, and retries can be billed twice. See retries and fallback.
- Spend records and budgets per client key, team and route, using prices you enter, and an opt-in exact-match cache that is separate for each team. They are kept in a SQLite file. A hard budget is not an exact cap, because cost is estimated before each call. Cached answers are stored unredacted. See budgets and the cache.
- Claude and Gemini routes support part of the OpenAI format, mainly text and function tools. Anthropic has no embeddings API. For tool use, Sanvaya keeps some model data in memory, which needs a single server process.
- An Agent Passport for each request (with a store): a record of what it was allowed to do, what was sent to which model, why it stopped, what it cost and whether it can be replayed (a request cannot). Finished records are tied to a hash-chained audit log. By default they keep a redacted copy of the request, and redaction misses things. See Agent Passport.
- OpenTelemetry traces, sent only to a collector you configure, without prompts or answers. A Compose file runs a collector and Jaeger on your machine. See telemetry.
- Agent runs, in paper or simulation mode only. A caller names a configured agent and a goal. Keelgate's loop plans in steps, and every tool call goes through its tool gate: a grant, a policy, and a person's approval, typed in a terminal, where the policy asks for one. A run can be resumed, is one trace, and has an Agent Passport for each start or resume, which can be replayed. A tool is Python code, and Sanvaya cannot see what it changes. Tried live with Claude and Gemini models only, and the approval step only with a simulated model. See Agent runs and the example.
- Client keys protect everything under
/v1. - Limits on slow and many clients: a request that takes too long to arrive is cut off with a
408(20 seconds for the headers, 120 for the body), open connections are capped (1000 in all, 100 for each address), a client that stops reading is dropped after 60 seconds, and a client key may cap how many requests it runs at once. All are settings, tested on loopback only, and there is no rate limit. See the threat model, T12. - HTTPS: the server can serve HTTPS itself (TLS 1.2 or later) or run behind a TLS proxy. Plain HTTP is allowed on loopback only, or between a proxy and the server in proxy mode.
- Local unless approved: listening beyond this machine, or in proxy mode, needs a client key, one of those two TLS modes and an approval typed in a terminal. Approvals expire and can be revoked. They guard against accidents. They do not stop a program running as your user, and they do not control firewalls or tunnels.
Planned
Everything in this list is planned and not built.
Later:
- Budgets for an agent as such, runs in the background and approval over a signed channel
- Self-healing actions
- Online evals and a judge library
- IDE extensions
- A semantic cache
- Postgres as a store
- The OpenAI Responses API and the Anthropic Messages API for clients
- A published container image
- Signed exposure approvals
- A guardrail pipeline for requests and answers
- Token optimisation, with quality tests before anything changes what a model sees
- Basic eval replay
This list is not a commitment or a schedule. The changelog records what has shipped, and status says what can be claimed today.
Try it from source
Sanvaya is an alpha on PyPI (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 PowerShell, set the variable with $env:OPENAI_API_KEY = "placeholder" instead of export.
check does not contact a provider, so a placeholder passes it. A real call also needs a real
model name in place of replace-with-a-model-name in the example, and a real key. up keeps
running in that terminal until you stop it with Ctrl+C.
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. In Windows PowerShell, type
curl.exe (with the .exe), because plain curl there is a different command. Pasting a URL
into a browser works too. Do not type a bare URL into a terminal.
The example listens on this machine only, over plain HTTP. To check that, run
netstat -an | findstr 8080 (Windows) or ss -ltn | grep 8080 (Linux). The line should start with
127.0.0.1:8080. A 0.0.0.0:0 further along the line is the column for the remote side, not a
second listener. To turn on HTTPS, see docs/CONFIG.md.
Development
uv sync
uv run ruff check .
uv run ruff format --check .
uv run mypy
uv run pytest
The tests need the openssl command on your PATH, to test HTTPS, and they fail, not skip,
without it. On Windows, Git for Windows ships one in C:\Program Files\Git\usr\bin. The full run
takes from about 2 to 10 minutes. Three tests skip on Windows, because they check POSIX file
permissions.
The HTTPS tests create temporary certificates for each run.
Security
To report a vulnerability, follow SECURITY.md. Please do not post exploit details in a public issue. Private vulnerability reporting is turned on, and the project owner opened its form on 2026-12-03.
The threat model is incomplete. Four AI reviews have been done and none by a person other than the author, so it has not been independently reviewed.
More
Architecture, configuration, agent runs, Agent Passport, releasing, a brief for an outside security reviewer, status: what can be said today, live tests and the changelog.
License
Apache-2.0. See LICENSE.
Metadata
Release files for sanvaya 0.1.0a7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sanvaya-0.1.0a7.tar.gz | 249.3 kB | With provenance | Details for sanvaya-0.1.0a7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sanvaya-0.1.0a7-py3-none-any.whl | Python 3 | none | any | Details for sanvaya-0.1.0a7-py3-none-any.whl |
Total release size: 411.7 kB
Release files / sanvaya-0.1.0a7.tar.gz
| Download URL | sanvaya-0.1.0a7.tar.gz |
|---|---|
| Size | 249.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9cbeb82a131f2f8e5f38b9b82acda9758e2f30d06e4b3cdc9527aae5d090c08f
|
|
BLAKE2b-256 checksum How to use checksums |
e8191379e2fe90be9fe3439ae11fd9e156f99276dbe93bcf10452ed622d6238a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 4, 2026.
Transparency logRelease files / sanvaya-0.1.0a7-py3-none-any.whl
| Download URL | sanvaya-0.1.0a7-py3-none-any.whl |
|---|---|
| Size | 162.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
69c69c7e0d4649bc32c44aba6ff04fcfd2c9643190acdb388e3bf9ad621a09c5
|
|
BLAKE2b-256 checksum How to use checksums |
5bf986c71ee1b9ca47a08f4230c3fdc800fdba512563396b62dbdfbd85b50b81
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 4, 2026.
Transparency logSecurity for sanvaya 0.1.0a7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for sanvaya-0.1.0a7.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 4, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.