AI · CLI · PostgreSQL · MySQL · Oracle

The AI command line
for working databases.

payp is Claude Code for data engineers. A chat-first CLI that connects live databases to the model of your choice — with the safest AI-to-SQL workflow available.

  • Speak natural language. payp writes the SQL. You approve, edit with Tab, or run it.
  • Two-model validation, row snapshots, and reverse-SQL for every destructive statement.
  • Tiered schema context that scales to 4,000+ tables without flooding the prompt.
Read the docs →
Works natively with your existing databases —
no adapters, no translation layer
§01What it is

A database-first chat loop — not a SQL editor with AI bolted on, not a coding assistant that happens to touch Postgres.

Schema-aware

payp introspects your database on connect and builds a tiered context (T0–T3) so the model sees the right tables, columns, and relationships — even across 4,000-table schemas.

Multi-model, multi-DB

Route through OpenRouter and talk to Claude, GPT, Gemini, Qwen, or Ollama against PostgreSQL, MySQL, or Oracle — in the same session, with one connection file.

Safe by default

Every destructive statement ships with auto-generated reverse-SQL. Every DML gets a snapshot up to 10K rows. Every operation lands in a SQLite audit log.

§02Five pillars

Built around the five things that make database work different from writing code.

Reversibility
Every DDL and DML is paired with reverse-SQL at generation time. ALTER TABLE ships with its undo. UPDATE and DELETE keep a snapshot. Type /rollback and the last operation unwinds — even days later.
Two-model validation
In secure-auto mode, one model generates SQL and a different provider reviews it before execution. A Claude executor with a GPT reviewer catches more mistakes than any single model talking to itself.
Tiered schema context
T0 = current focus. T1 = related tables. T2 = foreign-key neighborhood. T3 = the rest, summarized. The model gets what it needs, your token budget stays sane, and 4,000-table databases stop being a wall.
Cross-database operations
Compare schemas between prod and staging. Diff row counts across PostgreSQL and Oracle. Generate a migration that lands identically on MySQL. payp holds multiple connections open and knows the dialects.
Team-shareable context
payp.toml profiles, schema annotations, business glossaries, and saved queries live in your repo. Secrets stay in OS keyring or .cred files with chmod 600. Clone the repo, add your key, you're running.
§03Why not just MCP

Claude Code + a Postgres MCP gets you a chat window. payp gets you a workflow.

CapabilityClaude Code + MCPpayp
Schema awarenessFlat dumpTiered T0–T3, 4,000+ tables
Reverse-SQL on DDL/DMLAuto-generated, every statement
DML row snapshotsUp to 10K rows, rollback anytime
Two-model validationExecutor + reviewer, different providers
Transaction logSQLite audit trail, git-reflog style
Cross-DB ops (PG / MySQL / Oracle)One session, dialect-aware
EXPLAIN interpreted by LLMPlan analysis + index suggestions
Streaming export (CSV/JSON/Parquet/Excel)Built-in, handles millions of rows
Security modesAllow / denyManual · YOLO · Secure · Secure-Auto
PersonaGeneric coderDE · Architect · Analyst · DBA · Security
§04What you get

Three things you'll use every day — and a dozen more you'll keep finding.

Precision

Ask for what you need. Get exactly that.

Describe the query in plain English. payp writes dialect-aware SQL, explains the join strategy, and formats results before showing you anything. Tab to edit, Enter to run.

See more patterns →
payp> top customers by revenue last quarter
# generated sql
SELECT c.name, SUM(o.amount) AS revenue
FROM customers c
JOIN orders o ON c.id = o.customer_id
WHERE o.created_at >= '2025-10-01'
GROUP BY c.name
ORDER BY revenue DESC LIMIT 10;

[Enter: execute] [Tab: edit]
Visualization

Charts and dashboards. No browser required.

Ask for a breakdown, get a terminal bar chart. Ask for a trend, get a line plot. Ask for a dashboard, launch a full TUI with live metrics. All rendered with plotext, all keyboard-driven.

Open a dashboard →
payp> /dashboard sales

▌ SALES · LAST 30 DAYS · live
────────────────────────────────
Revenue ████████████░░ $124K
Orders ████████░░░░░░ 842
Customers ██████░░░░░░░░ 156
AOV █████████░░░░░ $147

tab ▸ next pane · q ▸ quit
Cross-DB

Compare, diff, migrate across engines.

Switch between PostgreSQL, MySQL, and Oracle mid-session. Diff schemas between prod and staging. Compare row counts. Generate a migration that runs identically across dialects.

See cross-db ops →
payp> /db

Your connections:
1. prod-analytics · PostgreSQL 16.2 · 2h ago
2. staging-mysql · MySQL 8.0 · 3d ago
3. oracle-legacy · Oracle 19c · 1w ago
──────────────────
+ New connection

Select:
§05Security modes

Four modes, picked per session. Match the guardrail to the blast radius.

/mode manual

Manual

// the default

Every SQL statement is shown before execution with its reverse-SQL. Enter to run, Tab to edit inline, Esc to cancel.

payp> drop idx_orders_stale
DROP INDEX reverse:
CREATE INDEX ...
[Enter · Tab · Esc]
/mode secure

Secure

// confirmation required

Auto-execute read-only queries. Every destructive statement (INSERT, UPDATE, DELETE, DDL) stops for explicit approval with full context.

✓ SELECT passed
⚠ UPDATE needs confirm
3 rows affected
/mode secure-auto

Secure-auto

// two-model validation

Executor model writes SQL. A different reviewer model inspects it. Read-only queries pass through. Destructive statements need both signatures.

claude → generates
gpt-5 → reviews
✓ approved · read-only
/mode yolo

YOLO

// for local sandboxes

Auto-execute everything, no prompts. Reserved for ephemeral environments where the worst case is a docker compose down -v.

⚠ YOLO enabled
All queries run without
confirmation.
payp>
§06Get started

One command to install. Two prompts to connect.

Install the CLI

Python 3.11+ via pipx, keeps your global env clean.

Pick a provider

Anthropic, OpenAI, Google, Ollama, or any model via OpenRouter with one key.

Connect a database

PostgreSQL, MySQL, or Oracle. Schema introspects automatically.

Start talking

Ask for data in natural language. payp writes the SQL, you approve it.

# 1. install
$ pipx install payp

# 2. first run — interactive setup
$ payp
Welcome to payp. Let's get you set up.
Step 1 of 2: AI Model
Step 2 of 2: Database Connection

# 3. start working
payp> show active subscriptions expiring this week

Open source. Built with the people
who'll use it every day.

payp is MIT-licensed and community-driven. File an issue, open a PR, or join the room where the roadmap gets argued out.