Metadata-Version: 2.1
Name: reducto-cli
Version: 0.2.0
Summary: Reducto CLI: parse, extract, split, classify and edit documents from the shell
Home-page: https://github.com/reductoai/cli
Author: Reducto
License: Apache-2.0
Project-URL: Documentation, https://docs.reducto.ai
Project-URL: Source, https://github.com/reductoai/cli
Project-URL: Changelog, https://github.com/reductoai/cli/blob/master/CHANGELOG.md
Keywords: reducto,pdf,ocr,document,parse,extract,cli
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Environment :: Console
Requires-Python: >=3.8
Description-Content-Type: text/markdown

# Reducto CLI

The Reducto document platform in your shell: parse, extract, split, classify and edit
documents from the command line, in scripts, and inside agent workflows.

One static binary. No runtime. Every field of the Reducto API is reachable without waiting
for a CLI release.

```bash
curl -fsSL https://reducto.ai/cli | sh
reducto login
reducto parse report.pdf
```

## Table of Contents

- [Why Reducto](#why-reducto)
- [Installation](#installation)
- [Authentication](#authentication)
- [Quick Start](#quick-start)
- [Commands](#commands)
- [Any API field](#any-api-field)
- [Inputs and outputs](#inputs-and-outputs)
- [Supported File Types](#supported-file-types)
- [Use Cases](#use-cases)
- [Configuration](#configuration)
- [Upgrading from 0.1.x](#upgrading-from-01x)
- [Development](#development)
- [Related Projects](#related-projects)
- [Resources](#resources)

## Why Reducto

Reducto is the agentic document platform for leading AI teams who demand enterprise
performance at scale. We provide a comprehensive toolkit for working with documents the way a
human would, combining custom in-house and leading frontier models to power efficient and
accurate document workflows.

The CLI brings that platform directly into your shell, scripts, and agent workflows.

### Performance for you

Zero-shot accuracy on complex documents where other solutions aren't production-ready.
Reducto orchestrates multiple models under the hood — routing, probes, and agentic VLM
multipasses — and continuously updates them so you don't have to chase the frontier. Handles
the long tail: tables, charts, figures, handwriting, scans.

### Enterprise ready

Hosted, VPC, on-premises, and air-gapped deployments to meet any data residency or security
requirement. SOC 2 and HIPAA compliant with zero data retention by default.

### Complete toolkit

One platform for every document task — parse, classify, split, extract, edit. 30+ filetypes,
not just PDFs. Agent-ready tooling (CLI, MCP, plugins, integrations).

---

## Installation

| Method | Command |
|---|---|
| Shell (macOS, Linux) | `curl -fsSL https://reducto.ai/cli \| sh` |
| PowerShell (Windows) | `irm https://reducto.ai/cli.ps1 \| iex` |
| npm | `npm install -g @reductoai/cli` |
| pip / pipx / uv | `pip install reducto-cli` · `pipx install reducto-cli` · `uv tool install reducto-cli` |
| Go | `go install github.com/reductoai/cli/cmd/reducto@latest` |
| Binaries | [GitHub Releases](https://github.com/reductoai/cli/releases) (darwin, linux, windows · amd64, arm64) |

The npm and PyPI packages carry the same binary as the release; they do not download anything
at install time. The shell installer writes to `~/.local/bin`, the PowerShell installer to
`%LOCALAPPDATA%\Programs\reducto` (set `REDUCTO_INSTALL_DIR` to change either); both verify
the release checksum.

Check the install:

```bash
reducto version
```

## Authentication

```bash
reducto login
```

This opens a browser for a device-code sign in and saves the key to `~/.reducto/config.yaml`
(mode 0600). Without a browser, pass the key in: `reducto login --api-key <key>` or
`echo $KEY | reducto login --api-key -`.

The key is resolved in this order: `--api-key`, `$REDUCTO_API_KEY`, `~/.reducto/config.yaml`.

## Quick Start

```bash
# Parse a PDF into Markdown
reducto parse report.pdf

# Parse a folder, one output file per input
reducto parse ./invoices --out-dir parsed/

# Extract structured data with a JSON Schema
reducto extract invoice.pdf -s schema.json

# Or with a quick inline schema
reducto extract invoice.pdf -f vendor,total:number,due_date

# Edit a document with natural language
reducto edit w9.pdf -i "Name: Jane Doe. Check the Individual box." --save w9.filled.pdf

# Chain: parse once, reuse the job for extract
reducto parse contract.pdf -o id | reducto extract - -s terms.json
```

## Commands

| Command | What it does |
|---|---|
| `parse` | Document → markdown, chunks, tables, figures |
| `extract` | Document → JSON that matches your schema |
| `split` | Find sections or sub-documents by description |
| `classify` | Assign one of your categories to each document |
| `edit` | Fill forms and change text with instructions; returns a PDF |
| `upload` | Upload a file and print its `reducto://` handle |
| `job`, `jobs`, `cancel` | Inspect, list, and cancel async jobs |
| `studio` | Open a job in Reducto Studio |
| `search`, `schema`, `docs` | Find and inspect API fields; open the docs |
| `login`, `version` | Sign in; print CLI, SDK and API versions |

`reducto <command> --help` lists the flags and examples for each command.

Common flags on every API command:

```
-o <fmt>        auto | pretty | md | json | payload | id
-p <pages>      page selection, e.g. 1-5,8
--save <path>   write the output to a file (edit: download the PDF)
--out-dir <dir> with many inputs, one file per input
--async         submit and print the job id; do not wait
-j <n>          parallel requests for many inputs (default 4)
--dry-run       print the request body and exit; no network call
-q / -v         quiet / verbose
```

## Any API field

Named flags cover the common options. Everything else in the API is reachable too:

```bash
reducto search "merge tables"                 # find the field and its docs page
reducto schema parse formatting               # types and defaults for a section
reducto parse doc.pdf -S formatting.merge_tables=true -S retrieval.chunking.chunk_mode=section
reducto parse doc.pdf -c body.json            # a whole request body; flags layer on top
reducto parse doc.pdf --dry-run               # see exactly what would be sent
```

`-S path=value` takes a dotted path and a JSON value (bare words are strings). Before anything is
uploaded, the body is checked against the CLI's copy of the API spec: unknown paths, values
outside an enum and wrong primitive types are errors with a hint, so a typo never costs a
request. Fields newer than the CLI's spec go through with `--force`.

## Inputs and outputs

Inputs can be local files, directories (recursed, supported types only), `https://` URLs,
`reducto://` upload handles, `jobid://` handles from a previous command, or `-` for stdin.

Output goes to stdout. `-o` picks the shape: `md` for text, `json` for the full response,
`payload` for just the result, `id` for a handle you can pipe into the next command. Status
lines go to stderr, so `reducto parse a.pdf > a.md` is clean.

## Supported File Types

PDF, images (PNG, JPG, TIFF, WEBP), Word (DOC, DOCX), PowerPoint (PPT, PPTX), Excel
(XLS, XLSX, CSV), Apple Numbers, and more. See the
[docs](https://docs.reducto.ai) for the full list.

## Use Cases

### Invoice and Receipt Processing

```bash
reducto parse ./invoices --out-dir parsed/
reducto extract ./invoices -s schemas/invoice.json --out-dir extracted/
```

### Contract and Legal Document Review

```bash
reducto parse contract.pdf --agentic -S formatting.include='["change_tracking","comments"]'
reducto extract contract.pdf -s schemas/contract_terms.json --citations
```

### Form Processing and Auto-Fill

```bash
reducto edit onboarding.pdf -i "Employee: Alex Chen. Start date: 2025-04-01. Select Full-time." --save onboarding.filled.pdf
```

### Financial Statement Analysis

```bash
reducto extract quarterly_report.pdf -s schemas/financial_statement.json --deep
```

### Feeding Agents and LLM Pipelines

```bash
reducto parse spec.pdf --chunk section > spec.md
reducto parse spec.pdf -o json | jq '.result.chunks[].content'
```

## Configuration

| Setting | Source |
|---|---|
| API key | `--api-key`, `$REDUCTO_API_KEY`, `~/.reducto/config.yaml` |
| Base URL | `--base-url`, `$REDUCTO_BASE_URL` (default `https://platform.reducto.ai`) |
| Color | `--color auto\|always\|never`, `$NO_COLOR` |
| Telemetry headers | `DO_NOT_TRACK=1` or `REDUCTO_TELEMETRY=0` turns off the `X-Reducto-*` request headers |

The CLI only talks to the Reducto API (and to Reducto Studio during `login`). Nothing is sent
anywhere else.

## Upgrading from 0.1.x

Version 0.2.0 replaces the Python CLI with a single Go binary. The package names are the same
(`pip install reducto-cli`), the config file is the same, and `login`, `parse`, `extract`
and `edit` still exist. What changed:

- Output goes to stdout instead of a `<file>.parse.md` next to the input. Use `--save` for
  one file or `--out-dir` for a folder.
- `parse --change-tracking/--highlights/--hyperlinks/--comments` became
  `-S formatting.include='["change_tracking",...]'`.
- `edit` writes the PDF where `--save` points instead of `<file>.edited.pdf`.
- New: `split`, `classify`, `upload`, `job`, `jobs`, `cancel`, `studio`, `search`,
  `schema`, `docs`, and `-S` for any API field.

## Development

```bash
make build          # bin/reducto
make test           # gofmt, vet, tests
make spec           # refresh the embedded OpenAPI document (cmd/reducto/openapi.json)
make packages       # snapshot release + npm packages + wheels, for local checks
```

Releases: push a `vX.Y.Z` tag. The `Publish` workflow builds the binaries with GoReleaser,
creates the GitHub release, and publishes the PyPI wheels and npm packages from those same
binaries. See [CHANGELOG.md](CHANGELOG.md).

## Related Projects

| Project | Description |
|---------|-------------|
| [Reducto Python SDK](https://github.com/reductoai/reducto-python-sdk) | Python client for the Reducto API (`pip install reductoai`) |
| [Reducto Node.js SDK](https://github.com/reductoai/reducto-node-sdk) | Node.js client for the Reducto API (`npm install reductoai`) |
| [Reducto Go SDK](https://github.com/reductoai/reducto-go-sdk) | Go client for the Reducto API; the CLI is built on it |
| [Reducto Claude Code Plugins](https://github.com/reductoai/claude-plugins) | Official Reducto plugins for Claude Code |
| [Reducto Studio](https://studio.reducto.ai) | No-code web interface for document processing |

## Resources

- [Reducto Documentation](https://docs.reducto.ai)
- [API Quickstart](https://docs.reducto.ai/quickstart)
- [Security & Compliance](https://docs.reducto.ai/security/policies)
- [PyPI](https://pypi.org/project/reducto-cli/) · [npm](https://www.npmjs.com/package/@reductoai/cli)
