A proxy between an app and LLM APIs such as OpenAI and Anthropic. It detects and redacts PII, blocks or tokenizes sensitive content, restores values in responses, and logs traffic.
Overview
Grepture is an open-source AI gateway that sits between an application and an LLM provider such as OpenAI, Anthropic or Gemini. Requests are sent through the proxy with an X-Grepture-Target header naming the upstream API. The proxy applies rules to the request, forwards it, applies rules to the response, and returns the result to the client.
Rules are defined in a JSON file and can match on headers, body, URL or model. Actions include PII redaction using regex patterns (email, phone, SSN, credit card, IP, address, date of birth), find and replace, tokenizing JSON fields, replacing fields with a fixed value, blocking a request with a custom status, and log-only tagging. Each rule can apply to input, output or both, with a sampling rate. The rules file reloads when it changes or on SIGHUP.
Tokenized values are swapped for placeholders before the request leaves and restored in the response, including across streamed SSE chunks. The model sees tokens instead of real data, while the application gets a normal answer. The website also describes per-agent tool restriction, tracing, evals, cost tracking and a zero-retention mode.
Traffic logging covers request and response bodies. In local mode they are written to stdout. In cloud mode, bodies larger than 50KB are offloaded to S3-compatible object storage, with a 5KB preview kept in the database. Configuration uses environment variables for the port, an optional API key, the rules file path, optional plugin modules and the storage settings. The project can be self-hosted, and a hosted EU option is also offered.
Key features
- PII detection and redaction
- Tokenization with restoration in responses
- Request blocking rules
- Find and replace rules
- Streaming (SSE) support
- Hot-reloaded JSON rules
- Request and response body logging
- Plugin modules
Use cases
- Keep personal data out of prompts sent to LLM providers
- Block sensitive requests before they reach an API
- Log and trace LLM traffic
- Restrict which tools an agent may call
Does the same job as
Grepture Proxy doesn't name these products itself, but its own description shows it does the same job.