Skip to main content
Rehydra ships as three product surfaces: the SDK for application code, the CLI for terminal workflows, and the OpenCode plugin for agent privacy. Start with the one that matches how you work.

Choose Your Starting Point

SDK

Add Rehydra to your app and control anonymization in code.

CLI Tool

Protect files and piped text from the terminal.

OpenCode Plugin

Scrub secrets before OpenCode sends them to an LLM.

SDK

Use the SDK when you are building a product or integrating privacy into an existing system.
npm install rehydra
import { anonymizeRegexOnly } from 'rehydra';

const result = await anonymizeRegexOnly('Contact john@example.com');

console.log(result.anonymizedText);
// "Contact <PII type=\"EMAIL\" id=\"1\"/>"
Best for:
  • Server-side apps and backend services
  • Browser-based privacy workflows
  • Agent, proxy, or streaming integrations
  • Teams that need fine-grained control over detection and rehydration

CLI Tool

Use the CLI when you want to protect text quickly without writing application code.
npm install -g @rehydra/cli
rehydra anonymize input.txt -o output.txt
Best for:
  • Local document processing
  • Shell scripts and automation
  • Inspecting sensitive text before sharing it
  • Teams that want a no-code entry point

OpenCode Plugin

Use the OpenCode plugin when your coding agent should never send raw secrets to an LLM provider.
npm install @rehydra/opencode
{
  "plugin": ["@rehydra/opencode"]
}
Best for:
  • OpenCode-based agent workflows
  • Repositories with sensitive .env files
  • Local development environments using AI assistants
  • Teams adding privacy guardrails to coding agents

Shared Model

All three product surfaces follow the same core pattern:
1

Detect

Sensitive values are identified locally.
2

Protect

Originals are replaced with safe placeholders.
3

Restore

Original values can be rehydrated locally when needed.

Next Steps

Installation

View environment-specific install details for the SDK.

CLI Guide

Explore commands, options, and examples.

OpenCode Plugin Guide

Configure secret scrubbing for OpenCode.

API Reference

Dive into the SDK APIs and advanced features.