sphior-ai-governance-proxy
v0.1.0
Published
Zero-code AI governance recording. Point your OpenAI/Anthropic-compatible LLM calls at this self-hosted proxy; it forwards them unchanged and records tamper-evident, hash-only evidence to SPHIOR for ISO 42001 / EU AI Act / SOC 2. Your provider keys never
Maintainers
Readme
sphior-ai-governance-proxy
Zero-code AI governance recording. A self-hosted proxy that sits in front of your LLM provider (OpenAI / Anthropic-compatible). Point your app's base URL at it — it forwards every request unchanged and records the execution as tamper-evident, hash-only evidence to SPHIOR for ISO 42001 / EU AI Act / SOC 2.
- No code changes — just change your LLM base URL.
- Your provider keys never leave your infrastructure — they are forwarded upstream, never sent to SPHIOR.
- hash_only — only hashes and non-sensitive metadata (model, tokens, latency, trace id) are recorded.
- fail-safe — a recording failure never breaks your LLM call.
Records supporting evidence. Does not assert compliance, pass/fail, or an audit opinion.
Run
Get an ingestion token from your SPHIOR dashboard (Account → AI Governance → Ingestion tokens).
SPHIOR_AIGOV_TOKEN=<your-token> \
UPSTREAM_BASE_URL=https://api.openai.com \
npx -y sphior-ai-governance-proxy
# → listening on :8788 → https://api.openai.comThen point your SDK/app at the proxy:
// OpenAI SDK
new OpenAI({ baseURL: "http://localhost:8788/v1", apiKey: process.env.OPENAI_API_KEY });# or raw
curl http://localhost:8788/v1/chat/completions \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "Content-Type: application/json" \
-H "x-sphior-actor: support-agent" \
-d '{"model":"gpt-4o-mini","messages":[{"role":"user","content":"hi"}]}'Anthropic: set UPSTREAM_BASE_URL=https://api.anthropic.com and point at http://localhost:8788.
Coding agents
The agents your engineers run all day are LLM traffic too. Each one takes a base URL, so recording them needs no code and no plugin — point the base URL at the proxy and every call is recorded, whether or not the agent cooperates.
Codex CLI
# ~/.codex/config.toml
openai_base_url = "http://localhost:8788/v1"Or as an explicit provider, if you already use one:
[model_providers.sphior]
base_url = "http://localhost:8788/v1"
wire_api = "responses" # use "chat" for OpenAI-compatible gateways
env_key = "OPENAI_API_KEY"
model_provider = "sphior"Claude Code
SPHIOR_AIGOV_TOKEN=<your-token> UPSTREAM_BASE_URL=https://api.anthropic.com \
npx -y sphior-ai-governance-proxy
ANTHROPIC_BASE_URL=http://localhost:8788 claudeCursor / Windsurf / Cline
Set the custom OpenAI base URL in settings to http://localhost:8788/v1.
The proxy runs on your own machine or your own network. Provider API keys are forwarded upstream and never sent to SPHIOR, and prompts and outputs are never recorded — only hashes and metadata. Attribute per agent with
SPHIOR_ACTOR=codex(or thex-sphior-actorheader).
Attribution
Set the acting agent per request with the x-sphior-actor header (stripped before forwarding upstream),
or a default with the SPHIOR_ACTOR env var.
Environment variables
| Var | Required | Default |
|---|---|---|
| SPHIOR_AIGOV_TOKEN | yes | — |
| UPSTREAM_BASE_URL | no | https://api.openai.com |
| PORT | no | 8788 |
| SPHIOR_ACTOR | no | — (or x-sphior-actor header) |
| SPHIOR_AIGOV_ENDPOINT | no | https://sphior.com/api/ai-governance/ingest |
| SPHIOR_DEBUG | no | false |
What is recorded
Non-sensitive metadata only: model, tokens (from the response usage), latency, trace_id
(the response id), actor, and a policy_decision of allow / error. Prompts and outputs are
not sent to SPHIOR. Each event is canonicalized (RFC 8785 JCS), hashed (SHA-256), chained, and
periodically anchored to an append-only, independently verifiable record you can check with the open
sphior-verify tool — without trusting SPHIOR.
Other ways to record
Prefer explicit calls from your own code? Use the
@sphior/evidence SDK (Node; Python and Go also
available). From an AI agent, so it can record its own decisions — the layer a base-URL proxy cannot
see? Use sphior-ai-governance-mcp.
License
Apache-2.0
