{"id":50558433,"url":"https://github.com/leokwsw/openai-privacy-filter","last_synced_at":"2026-06-04T09:30:38.544Z","repository":{"id":353380646,"uuid":"1219165980","full_name":"leokwsw/openai-privacy-filter","owner":"leokwsw","description":"OpenAI Privacy Filter FastAPI Service","archived":false,"fork":false,"pushed_at":"2026-04-23T16:35:17.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-23T18:08:08.239Z","etag":null,"topics":["docker","fastapi","openai","privacy-filter","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leokwsw.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-23T15:42:12.000Z","updated_at":"2026-04-23T16:35:21.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/leokwsw/openai-privacy-filter","commit_stats":null,"previous_names":["leokwsw/openai-privacy-filter"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/leokwsw/openai-privacy-filter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leokwsw%2Fopenai-privacy-filter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leokwsw%2Fopenai-privacy-filter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leokwsw%2Fopenai-privacy-filter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leokwsw%2Fopenai-privacy-filter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leokwsw","download_url":"https://codeload.github.com/leokwsw/openai-privacy-filter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leokwsw%2Fopenai-privacy-filter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33899697,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-04T02:00:06.755Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","fastapi","openai","privacy-filter","python"],"created_at":"2026-06-04T09:30:37.631Z","updated_at":"2026-06-04T09:30:38.529Z","avatar_url":"https://github.com/leokwsw.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OpenAI Privacy Filter API\n\nEnglish | [简体中文](./README.zh-CN.md)\n\nFastAPI wrapper for [OpenAI Privacy Filter](https://github.com/openai/privacy-filter), with Docker, Docker Compose, and GitHub Container Registry publishing support.\n\nThis project helps you turn OpenAI Privacy Filter into a small self-hosted API service for PII detection and text redaction.\n\n## Why This Project\n\nOpenAI Privacy Filter is a strong local model for detecting and masking sensitive text such as names, emails, phone numbers, dates, addresses, account numbers, private URLs, and secrets. The upstream repo ships a Python package and CLI. This repo adds the missing deployment layer many teams want:\n\n- Simple REST API with FastAPI\n- Local-first deployment\n- Docker and Docker Compose support\n- GitHub Actions workflow to publish container images\n- Small integration surface for internal tools, RAG pipelines, ETL jobs, and document preprocessing\n\nIf you want to run OpenAI Privacy Filter as a backend service instead of calling the CLI directly, this repo is for you.\n\n## Use Cases\n\n- Redact PII before sending text to an LLM\n- Sanitize support tickets, chat logs, and transcripts\n- Clean internal documents before indexing into RAG systems\n- Build a privacy gateway for AI apps\n- Add an on-prem redaction layer to compliance-sensitive workflows\n\n## Features\n\n- `GET /health` health check\n- `POST /redact/text` text-only redaction response\n- `POST /redact/batch` batch redaction response with detected spans and latency\n- Configurable model device and checkpoint through environment variables\n- Docker image build and Compose-based local startup\n\n## API Overview\n\n### `GET /health`\n\nReturns service status and whether the model is loaded.\n\n### `POST /redact/text`\n\nRequest:\n\n```json\n{\n  \"text\": \"Alice lives at 1 Main Street and her email is [email protected]\"\n}\n```\n\nResponse:\n\n```json\n{\n  \"redacted_text\": \"[PRIVATE_PERSON] lives at [PRIVATE_ADDRESS] and her email is [PRIVATE_EMAIL]\",\n  \"latency_ms\": 123.45\n}\n```\n\n### `POST /redact/batch`\n\nRequest:\n\n```json\n{\n  \"texts\": [\n    \"Alice was born on 1990-01-02.\",\n    \"Call Bob at +1 415 555 0114.\"\n  ]\n}\n```\n\nReturns per-item redaction results, detected spans, summary metadata, and total latency.\n\n## Quick Start\n\n### 1. Local Python Run\n\n```bash\npython -m venv .venv\nsource .venv/bin/activate\npip install -r requirements.txt\npip install ./privacy-filter\npython main.py\n```\n\nThe API starts on `http://127.0.0.1:8080`.\n\n### 2. Docker\n\nCPU image:\n\nBuild the image:\n\n```bash\ndocker build -t openai-privacy-filter .\n```\n\nRun the container:\n\n```bash\ndocker run --rm -p 8080:8080 --env-file .env openai-privacy-filter\n```\n\n### 3. Docker Compose\n\nStart the service:\n\n```bash\ndocker compose up --build\n```\n\nRun in the background:\n\n```bash\ndocker compose up --build -d\n```\n\nStop it:\n\n```bash\ndocker compose down\n```\n\n## Environment Variables\n\nCommon options:\n\n- `PORT`: API port, default `8080`\n- `OPF_DEVICE`: `cpu`, `cuda`, `mps`, or `auto`; default `cpu`\n- `OPF_OUTPUT_MODE`: OpenAI Privacy Filter output mode, default `typed`\n- `OPF_CHECKPOINT`: optional custom checkpoint path\n\nExample `.env`:\n\n```env\nPORT=8080\nOPF_DEVICE=cpu\nOPF_OUTPUT_MODE=typed\n```\n\n## Positioning\n\nThis is not the official OpenAI repo. It is a deployment-focused wrapper around the official OpenAI Privacy Filter project.\n\nUpstream project:\n\n- [openai/privacy-filter](https://github.com/openai/privacy-filter)\n\nIf you need the core model, training flow, or evaluation tooling, start with the upstream repo. If you want to expose it as an API service quickly, use this repo.\n\n## SEO Keywords\n\nOpenAI Privacy Filter API, OpenAI Privacy Filter FastAPI, PII redaction API, PII masking service, self-hosted privacy filter, Docker privacy filter, local PII detection, OpenAI privacy filter server, privacy filter for RAG, privacy filter for LLM preprocessing.\n\n## License\n\nThis wrapper repo does not change the upstream model license. Review the upstream project for model and code licensing details:\n\n- [OpenAI Privacy Filter license](https://github.com/openai/privacy-filter)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleokwsw%2Fopenai-privacy-filter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleokwsw%2Fopenai-privacy-filter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleokwsw%2Fopenai-privacy-filter/lists"}