Reiki

Security proxy for agent and LLM traffic: isolates keys, filters what leaves, keeps access reliable

View the Project on GitHub ddproxy/reiki

Security

Reiki sits between a client (an agent such as opencode or Claude Code, or an application) and the providers it calls, isolating each side from what the other should not hold. It does not make either side trustworthy: a client that can read a secret on its own machine can still send it elsewhere, so masking backs up keeping secrets out of reach and does not replace it.

Reiki keeps From Through
Upstream API keys The client Key files read only by Reiki; credential headers replaced per request
Credentials and listed terms in prompts The provider The placeholders plugin (placeholders) swaps them for placeholders before the request leaves and restores them in the response
Arbitrary destinations The client Config-only upstreams and the tunnel allowlist
A record of what was sent Nobody; it is for you The requestlog plugin (requestlog), with credentials masked

Clients and keys

Network

Reiki listens on listen, default 127.0.0.1:4097, serves plain HTTP and has no TLS. Keep it on loopback, or put a TLS-terminating proxy in front before exposing it. Upstream URLs must be https, except loopback addresses used in tests.

Header handling

Reiki forwards every request header except hop-by-hop headers (connection, keep-alive, proxy-*, te, trailer, transfer-encoding, upgrade), host, content-length and the client credential headers. accept-encoding is replaced with identity so error bodies can be classified, unless the upstream sets forward_accept_encoding and the client sent one. Redirects from the upstream are not followed.

Interception

[tunnel.intercept] lets Reiki read the traffic of the hosts it lists, so treat the CA as a secret and the clients that trust it as covered by it.

Logging

Key values and stream tokens are not logged. Request and response bodies are not logged, except the first 160 characters of upstream error bodies at debug level, and whatever the requestlog plugin is configured to record, which masks credentials in paths, query parameters, credential headers and JSON keys and values.

Plugins

Plugins are compiled into the binary and run inside the Reiki process, so a plugin is as trusted as Reiki. A plugin sees request headers (including the client token) and bodies but never an upstream key, which is attached after the hooks run. Only compile in plugins you have read. Plugins covers the hooks and panic handling.

Limits

Key health. A stream-token holder can influence key health. A 401, or a 403 or 400 the upstream attributes to the key, takes that key out of rotation for every stream that lists it until it is rotated and Reiki receives SIGHUP. To bound the damage, one request disables at most one key: a second key that refuses the same request is tried but not disabled. With hold_unauthorized = true on the upstream, the disable waits until a later key serves the same request, so a request that every key refuses disables none. The invalid-key marker in a 400 body counts only as a real JSON field ("reason": "API_KEY_INVALID"), not as text an upstream echoed back.

Hardening