Metadata-Version: 2.4
Name: SynthAuth
Version: 2.0.0
Summary: AI Content Authenticator & OCR Engine — detect AI-generated text and AI-generated images with deep learning.
Author-email: Khushaal <khushaal@example.com>
License-Expression: MIT
Project-URL: Homepage, https://github.com/khushalv21/SYNTH
Project-URL: Repository, https://github.com/khushalv21/SYNTH
Project-URL: Issues, https://github.com/khushalv21/SYNTH/issues
Project-URL: Changelog, https://github.com/khushalv21/SYNTH/blob/main/CHANGELOG.md
Keywords: ai,authenticator,ocr,cli,nlp,content-detection,deepfake,image-forensics,midjourney,stable-diffusion,vision-transformer
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Text Processing :: Linguistic
Classifier: Typing :: Typed
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: typer<1,>=0.12
Requires-Dist: rich<16,>=13
Requires-Dist: easyocr<2,>=1.7
Requires-Dist: opencv-python-headless<5,>=4.9
Requires-Dist: pypdfium2<5,>=4.25
Requires-Dist: torch<3,>=2.2
Requires-Dist: transformers<6,>=4.40
Requires-Dist: Pillow>=10.0
Requires-Dist: python-dotenv<2,>=1.0
Requires-Dist: httpx<1,>=0.27
Requires-Dist: packaging>=23.0
Provides-Extra: dev
Requires-Dist: pytest>=8.0; extra == "dev"
Requires-Dist: pytest-cov>=5.0; extra == "dev"
Requires-Dist: ruff>=0.4; extra == "dev"
Requires-Dist: mypy>=1.10; extra == "dev"
Requires-Dist: pre-commit>=3.7; extra == "dev"
Requires-Dist: build>=1.2; extra == "dev"
Requires-Dist: twine>=6.0; extra == "dev"
Dynamic: license-file

<p align="center">
  <pre>
  ███████╗██╗   ██╗███╗   ██╗████████╗██╗  ██╗
  ██╔════╝╚██╗ ██╔╝████╗  ██║╚══██╔══╝██║  ██║
  ███████╗ ╚████╔╝ ██╔██╗ ██║   ██║   ███████║
  ╚════██║  ╚██╔╝  ██║╚██╗██║   ██║   ██╔══██║
  ███████║   ██║   ██║ ╚████║   ██║   ██║  ██║
  ╚══════╝   ╚═╝   ╚═╝  ╚═══╝   ╚═╝   ╚═╝  ╚═╝
  </pre>
</p>

<h3 align="center">synth cli</h3>

<p align="center">
  <strong>AI Content Authenticator & OCR Engine — v2.0.0</strong><br>
  <em>One command to verify text, images, and documents.</em>
</p>

<p align="center">
  <a href="#installation">Installation</a> •
  <a href="#the-unified-command">Smart Verify</a> •
  <a href="#commands">Commands</a> •
  <a href="#byok--custom-apis">BYOK / Custom APIs</a> •
  <a href="docs/ARCHITECTURE.md">Architecture</a>
</p>

---

## Installation

```bash
pip install SynthAuth
```

That's it. All dependencies (OCR, ML models, PDF support) are handled automatically.

```bash
synth --version
# synth v2.0.0
```

> **First run**: HuggingFace models are downloaded and cached automatically (~500 MB for text detection, ~350 MB for image forensics).

### One-Line Installer (Alternative)

```bash
curl -fsSL https://raw.githubusercontent.com/khushalv21/SYNTH/main/install.sh | bash
```

Silent progress bar. Auto-runs `synth info` on completion to prove it's ready.

---

## The Unified Command

Synth v2.0.0 has **one command** for everything:

```bash
synth verify <input>
```

It **automatically detects** what you give it and routes to the correct AI pipeline — no flags, no modes, no configuration.

### How Smart Verify Works

| What You Pass | What Synth Does |
|---|---|
| `photo.png` / `image.jpg` / `screenshot.webp` | → **AI Image Forensics** — Vision Transformer detects Midjourney, Stable Diffusion, DALL·E |
| `report.pdf` | → **OCR Extraction** → AI text detection on each page |
| `notes.txt` / `essay.md` | → **Reads file contents** → AI text detection (no OCR needed) |
| `"Some text in quotes"` | → **Direct AI text detection** on the raw string |
| `./documents/` | → **Batch scan** all supported files in the directory |

### Examples

```bash
# Image → auto-detects as image → vision forensics
synth verify photo.png

# PDF → extracts pages → OCR → text detection
synth verify report.pdf

# Text file → reads contents → text detection (skips OCR)
synth verify essay.txt

# Raw text → direct text detection
synth verify "The emergence of artificial intelligence has fundamentally transformed..."

# Directory → batch scan everything
synth verify ./submissions/

# Use a remote API instead of local model
synth verify essay.txt --engine api --agent gpt-4o
```

### Exit Codes

- `0` — Content verified as human-created
- `1` — AI-generated content detected (useful in CI/CD pipelines)

---

## Commands

| Command | Description |
|---|---|
| `synth verify <input>` | Verify content authenticity. Accepts images, PDFs, text files, directories, or raw text in quotes. |
| `synth update` | Auto-update the CLI to the latest PyPI version. |
| `synth info` | Display the Synth logo, version, system diagnostics, and compute device. |
| `synth help` | Show a clean, formatted command reference menu. |

### Verify Options

| Flag | Default | Description |
|---|---|---|
| `--engine`, `-e` | `local` | Detection strategy: `local` (HuggingFace) or `api` (remote) |
| `--agent`, `-a` | *(auto)* | Model name (local) or model ID (API) |
| `--show-text` / `--no-text` | `--show-text` | Toggle extracted text panel with AI-pattern highlighting |
| `--lang`, `-l` | `en` | Comma-separated OCR language codes (e.g. `en,fr,de`) |

### Global Flags

| Flag | Description |
|---|---|
| `--version`, `-V` | Print version and exit |
| `--verbose` | Enable debug logging |

---

## BYOK / Custom APIs

Synth supports **Bring Your Own Key** — connect to any OpenAI-compatible API endpoint (OpenRouter, Groq, Together, Ollama, or your own service).

### Quick Setup

Create a `.env` file in your project root:

```env
SYNTH_API_BASE_URL=https://api.openai.com/v1/chat/completions
SYNTH_API_KEY=sk-your-key-here
SYNTH_API_MODEL=gpt-4o
```

Then run with the `api` engine:

```bash
synth verify essay.txt --engine api
```

### OpenRouter

```env
SYNTH_API_BASE_URL=https://openrouter.ai/api/v1/chat/completions
SYNTH_API_KEY=sk-or-v1-your-key-here
SYNTH_API_MODEL=anthropic/claude-sonnet-4
```

### Groq

```env
SYNTH_API_BASE_URL=https://api.groq.com/openai/v1/chat/completions
SYNTH_API_KEY=gsk_your-key-here
SYNTH_API_MODEL=llama-3.3-70b-versatile
```

### Custom Payload Mappings

For APIs with non-standard request/response formats, point to a JSON config:

```env
SYNTH_PAYLOAD_MAP=./config/payload_openai.json
```

Sample configs provided:
- `config/payload_openai.json` — OpenAI chat completions
- `config/payload_anthropic.json` — Anthropic Messages API

For full details, see the **[Universal API Guide](docs/UNIVERSAL_API_GUIDE.md)**.

---

## Supported Formats

| Type | Extensions |
|---|---|
| **Images** | `.png` `.jpg` `.jpeg` `.webp` `.bmp` `.tiff` |
| **Text files** | `.txt` `.md` `.rst` `.csv` `.log` |
| **Documents** | `.pdf` (multi-page) |
| **Raw text** | Any quoted string |

---

## Project Structure

```
SynthAuth/
├── pyproject.toml              # Package metadata & dependencies
├── install.sh                  # Silent one-line installer
├── .env.example                # API config template
├── config/
│   ├── payload_openai.json     # OpenAI payload mapping
│   └── payload_anthropic.json  # Anthropic payload mapping
├── docs/
│   ├── ARCHITECTURE.md         # Technical deep-dive
│   └── UNIVERSAL_API_GUIDE.md  # API configuration guide
├── src/synth/
│   ├── __init__.py             # Version string
│   ├── cli/
│   │   ├── main.py             # CLI router & smart verify
│   │   └── display.py          # Rich TUI components & help menu
│   └── core/
│       ├── auth.py             # Text & Vision authenticators (BYOK engine)
│       ├── device.py           # Hardware auto-detection
│       ├── exceptions.py       # Custom exceptions
│       └── ocr.py              # OpenCV + EasyOCR + PDF pipeline
└── tests/                      # Pytest suite
```

---

## Development

```bash
git clone https://github.com/khushalv21/SYNTH.git
cd SYNTH
python3 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"

# Run tests
pytest

# Lint
ruff check src/ tests/

# Type check
mypy src/
```

---

## License

MIT — see [LICENSE](LICENSE) for details.
