Skip to content
ddproxyPublic

About

Resources

Security policy

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

Reiki logo

Reiki

ci CodeQL OpenSSF Scorecard Release License

Reiki is a security proxy for coding-agent and LLM traffic. It sits between a client and the providers it calls, keeps upstream API keys in files on the Reiki host, and gives the client a revocable stream token instead. Requests pass through one place where Reiki can rotate and fail over keys, filter outbound content and expose health and logs. Reiki runs as one binary, reads one TOML file and compiles plugins in at build time.

Is it for you

Situation What Reiki does
An agent or application would otherwise hold provider API keys The client sends a Reiki stream token; Reiki reads the upstream key from a file and sets the credential per request.
You need to keep one key working across rate limits, quota failures or a bad key A stream chain can try other keys and, when configured, a fallback upstream.
You need to limit or inspect what leaves the machine Upstreams come from the config, plugins can mask or block content, and the request log and metrics show what happened.
You run several instances and need a shared view of key health Peers publish a read-only health summary that other instances and reiki top can read.

Read in this order

  1. Overview — the model and the listeners. Use the glossary for CLI and status vocabulary.
  2. Configuration and command line — every table and flag; then keys and streams.
  3. Providers — mapping and test coverage; then failover and classification.
  4. Security — assets and trust boundaries; then the redaction reference and the egress plugins: placeholders, PHI, finance, controlled information, tool policy.
  5. Request log, monitoring, troubleshooting and the FAQ — observe and diagnose.
  6. Tunnel, shaping, peers, reiki top and hub — optional subsystems.
  7. Deploy, upgrades and worked examples — run, change and see the output.

The full index is docs/README.md.

Install

From a checkout (Rust 1.99 or newer), make install builds with reiki top and puts reiki in ~/.local/bin, or in /usr/local/bin as root. PREFIX=/opt/reiki make install picks another prefix.

Or download a prebuilt archive from the releases page (Linux static musl and macOS, x86_64 and aarch64; reiki top included), check it against its .sha256 file and copy reiki onto your PATH.

Plugin selection and order are build arguments; see plugins. To write a plugin, see plugin authoring. For service files and first-start checks, see deploy.

Security

Report vulnerabilities privately as described in SECURITY.md. Security scanning lists the repository checks, where their findings appear and the settings the owner must enable.

Verify a release

Archives ship with .sha256 files, a CycloneDX SBOM and build provenance attestations. Check the one you use:

tag=v0.14.0
gh release download "$tag" --repo ddproxy/reiki \
  --pattern '*.tar.gz' --pattern '*.sha256' --pattern '*-sbom.json' --dir dist
gh attestation verify "dist/reiki-$tag-x86_64-unknown-linux-musl.tar.gz" --repo ddproxy/reiki
(cd dist && shasum -a 256 -c *.sha256)

The .sha256 files cover the archives and reiki-$tag-sbom.json; the SBOM lists the components in the release build.

Quick start

This sets up one upstream, one key, one stream and an admin listener so you can see the result.

  1. Write the provider key to a file that only Reiki's user can read.

    umask 077
    printf '%s' "$PROVIDER_KEY" > /path/to/keys/example-a
  2. Choose a client token and an admin token (each at least 16 characters) and hash them.

    printf '%s' "$CLIENT_TOKEN" | reiki hash-token
    printf '%s' "$ADMIN_TOKEN"  | reiki hash-token
  3. Save reiki.toml with the hashes from step 2.

    listen = "127.0.0.1:4097"
    
    [upstream.example]
    base_url = "https://api.example.com/v1"
    
    [keys.example-a]
    upstream = "example"
    file = "/path/to/keys/example-a"
    
    [streams.client-a]
    token_sha256 = "<hash of $CLIENT_TOKEN>"
    chain = ["example-a"]
    
    [admin]
    listen = "127.0.0.1:4098"
    token_sha256 = "<hash of $ADMIN_TOKEN>"
  4. Check the setup, then run Reiki.

    reiki --config reiki.toml check
    reiki --config reiki.toml
  5. Point one agent at Reiki and send a request. For OpenCode, set provider.opencode.options.baseURL to http://127.0.0.1:4097/example and apiKey to $CLIENT_TOKEN (see Providers). You can also call Reiki directly:

    curl -s http://127.0.0.1:4097/example/chat/completions \
      -H "Authorization: Bearer $CLIENT_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{"model":"example-model","messages":[{"role":"user","content":"ping"}]}'
  6. See the result from the running instance.

    REIKI_ADMIN_TOKEN=$ADMIN_TOKEN reiki keys
    REIKI_ADMIN_TOKEN=$ADMIN_TOKEN reiki failures --limit 5

reiki keys shows each key's state and last status. reiki failures shows recent failures from the in-memory ring. For a real provider, replace example, base_url and model with values from Providers.

Documentation

Start

Keys and providers

  • Providers: upstreams, transport, forwarding, fallback and passthrough.
  • OpenCode: base URL, client token, proof check and bypasses.
  • Claude Code: base URL, client token, proof check and bypasses.
  • Failover: chains and key states.
  • Classification: response rules, one cooldown table and client errors.
  • Shaping: outbound budgets and limits.

Plugins and egress

Operations and security

  • Deploy: install paths, directory layout, listeners and a service unit.
  • Upgrades: reload and restart rules and rollback.
  • Monitoring: the admin listener, /v1/status, /v1/metrics and key checks.
  • Peers: read-only key health shared between instances; health document schema.
  • Peers publishing: listener, tokens and stream names.
  • Top: the live fleet view.
  • Hub: hub configuration, parsed and validated in this release.
  • Troubleshooting: status codes, logs, reload and common problems.
  • FAQ: short answers to the questions asked most often.
  • Security: protections, limits and trust boundaries.
  • Security scanning: repository checks, findings and release verification.
  • Observe, then enforce: placeholders, report mode, reiki scan and the reload gate.
  • What Reiki does not protect against: key-file modes, plugins, tunnels and encodings.

Develop

cargo fmt --check
cargo clippy --all-targets -- -D warnings
cargo test

License

MIT

About

Resources

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages