Skip to content

About

AI to human text, which you can use with your antigravity, codex, and claude-code and dont worry its free, have fun.

Topics

Resources

Contributing

Stars

5 stars

Watchers

0 watching

Forks

Repository files navigation

humanizeai-cli

A zero-dependency Python CLI and library for text rewriting via the humanizeai.pro web endpoint (POST /api/process).

Note: This client interacts with the web application's endpoint, not the paid public API (api.humanizeai.pro/v1). It does not try to work around or crack Cloudflare Turnstile in any way — instead, it lets you transfer your own browser's session cookie and Turnstile token quickly and repeatedly.

Features

  • Zero runtime dependencies — uses the Python 3.9+ standard library only (urllib, sqlite3, argparse, dataclasses).
  • Automatic document chunking — breaks up long texts on paragraph and sentence boundaries (--max-words 180 by default) to stay within the endpoint's ~200-word per-request limit and stitches them back together.
  • Simple browser handoff —
    • Reads existing humanizeai.pro cookies locally from Chrome, Chromium, Brave, Edge, Arc, Vivaldi, or Firefox without sending them anywhere.
    • Parses Chrome and Firefox DevTools Copy as cURL dumps (--from-curl).
    • Watches your clipboard (--wait-token) and caches valid tokens locally (~/.humanizeai/session.json, 0600 permissions) for 30 minutes (--token-ttl 1800).
  • Unix-style CLI — takes inline text, stdin, single files (-i/-o), or batch mode (-i ... --outdir), keeping stdout clean for rewritten text and logging progress to stderr.
  • Agent-ready — ships a portable Agent Skill for Antigravity, Codex, and Claude Code, plus an AGENTS.md operating guide with clear exit codes and a non-destructive output policy.

Installation

Requires Python 3.9+.

# Install globally as a CLI tool (recommended for using from any folder or agent skill)
pipx install git+https://github.com/igotlinux/humanizeai-cli.git
# (or with pip: pip install git+https://github.com/igotlinux/humanizeai-cli.git)

For local development:

# Clone the repository
git clone https://github.com/igotlinux/humanizeai-cli.git
cd humanizeai-cli

# Install into a virtual environment
python3 -m venv .venv
source .venv/bin/activate
pip install -e .

Or run directly without installing:

PYTHONPATH=src python3 -m humanizeai_cli --help

Quick Start

1. First run of a session (grab your cookie & Turnstile token once)

humanizeai automatically reads humanizeai.pro cookies from your local browser profile (Chrome, Brave, Edge, Arc, Vivaldi, or Firefox), and Copy as cURL hands over both the cookie and a fresh Turnstile token in one step.

Start the CLI in wait mode first:

humanizeai --wait-token -i examples/sample.txt -o sample.human.txt

While it waits in your terminal:

  1. Open https://www.humanizeai.pro in your browser.
  2. Open DevTools (Cmd+Opt+I on macOS, Ctrl+Shift+I on Windows/Linux) and switch to the Network tab before clicking anything. Filter by process (or Fetch/XHR).
  3. Type or paste a short test sentence into the website's text box (for example: This is a short test sentence.). The site will not send a /api/process request if the text box is empty.
  4. Click Humanize AI once and wait a moment for the POST /api/process request to finish with status 200. (Ignore any OPTIONS preflight row or failed request — only a 200 POST carries a valid turnstileToken.)
  5. Right-click that process row → Copy → Copy as cURL (on Windows, choose Copy as cURL (bash)).

humanizeai automatically detects the cURL dump on your clipboard, extracts both the Cookie header and turnstileToken, saves them to ~/.humanizeai/session.json (0600 permissions, cached for 30 minutes), and processes your file.

Why isn't there a DevTools Console JS snippet to copy the cookie? Cloudflare sets cf_clearance with the HttpOnly flag, which browsers intentionally hide from JavaScript (document.cookie). No Console script can read HttpOnly cookies — using Copy as cURL from the Network tab is the built-in browser way to copy both the HttpOnly cookie and the JSON turnstileToken in one click.

You can also pipe an already-copied cURL request directly instead of using --wait-token:

pbpaste | humanizeai --from-curl - -i examples/sample.txt -o sample.human.txt

2. Subsequent runs (token cached)

# File in, file out
humanizeai -i examples/sample.txt -o sample.human.txt

# Inline text to stdout
humanizeai --text "Paste a paragraph here to rewrite."

# Pipe from stdin
cat examples/sample.txt | humanizeai > sample.human.txt

# Batch mode (writes abstract.human.txt, intro.human.txt, ...)
humanizeai -i abstract.txt -i intro.txt --outdir humanized/

# Inspect cached session (secrets masked) or preview payload without sending
humanizeai --show-session
humanizeai -i examples/sample.txt --dry-run

CLI Reference

Input & Output

Flag Description
text / --text TEXT Inline text to humanize.
-i, --input PATH Input UTF-8 file (repeatable for batch mode).
-o, --output PATH Output file path (single input; default is stdout).
--outdir DIR Output directory for batch mode.
--suffix STR Filename suffix for batch outputs (default: .human).

Credentials & Session

Flag Description
--wait-token [SECONDS] Poll clipboard for a Turnstile token or cURL dump (default: 120 seconds).
--from-curl PATH|- Extract cookie, headers, style defaults, and token from a saved cURL dump or stdin.
--cookie VALUE Override the HTTP Cookie header for this run.
--save-cookie VALUE Persist a Cookie header to the session file and exit.
--token VALUE Supply a Turnstile token directly.
--token-command CMD Shell command whose stdout yields a fresh token.
--token-ttl SECONDS Cached token lifetime in seconds (default: 1800; 0 disables caching).
--no-cache Ignore any cached token for this run.
--no-browser-cookies Skip reading cookies from local browser profiles.
--session-file PATH Custom session file path (default: ~/.humanizeai/session.json).
--show-session Print the stored session with secrets masked and exit.

Style & Processing

Flag Description
--style STYLE standard, academic, simple, flowing, informal, formal, expand, shorten.
--mode MODE quality, balanced, bypass.
--ultra Enable the Ultra model (paid accounts).
--keyword WORD Keyword to preserve (repeatable).
--max-words N Maximum words per chunk (default: 180; 0 disables chunking).
--json Emit the raw JSON response(s) to stdout.
--dry-run Print the request payload without sending an HTTP request.
-q, --quiet Suppress progress logs on stderr.

Environment Variables

Session fields can also be overridden via environment variables:

  • HUMANIZEAI_COOKIE
  • HUMANIZEAI_TURNSTILE_TOKEN
  • HUMANIZEAI_SESSION_ID
  • HUMANIZEAI_USER_AGENT

Exit Codes

Code Meaning
0 Success
1 Invalid input, network error, or API rejection
2 Missing browser cookie or Turnstile token
130 Cancelled via Ctrl-C

Python API

You can also import and use the client directly from Python:

from humanizeai_cli import Session, WebHumanizer, chunk_text

session = Session.load()
client = WebHumanizer(session)

for chunk in chunk_text("Your long text goes here...", max_words=180):
    result = client.humanize(
        chunk.text,
        token=session.cached_token(ttl=1800),
        style="academic",
        mode="balanced",
    )
    print(result.text, end=chunk.separator)

AI Agent Skill (Antigravity, Codex & Claude Code)

This repository ships a portable Agent Skill following the open Agent Skills specification so coding agents know how to check session status, walk you through copying a Turnstile token, extract plain prose safely from Markdown files, and verify output word counts and exit codes.

  • Inside this repo: Automatically discovered by Antigravity and Codex via .agents/skills/humanizeai/SKILL.md, and by Claude Code via .claude/skills/humanizeai/SKILL.md.
  • Use globally across any project: First install the CLI on your PATH (pipx install git+https://github.com/igotlinux/humanizeai-cli.git), then install the skill for your agent:
# Cross-agent installer (Antigravity, Codex, Claude Code, Cursor, etc.)
npx skills add igotlinux/humanizeai-cli

# Or copy manually after cloning this repo:
# Antigravity (global)
mkdir -p ~/.gemini/config/skills && cp -R .agents/skills/humanizeai ~/.gemini/config/skills/humanizeai

# Codex CLI (global)
mkdir -p ~/.agents/skills && cp -R .agents/skills/humanizeai ~/.agents/skills/humanizeai

# Claude Code (global)
mkdir -p ~/.claude/skills && cp -R .agents/skills/humanizeai ~/.claude/skills/humanizeai

Project Structure

humanizeai-cli/
├── .agents/skills/humanizeai/
│   ├── SKILL.md                   # Portable Agent Skill (Antigravity / Codex / Claude)
│   └── references/
│       └── troubleshooting.md     # Progressive-disclosure error & chunking reference
├── .claude/skills/humanizeai      # Symlink to .agents/skills/humanizeai for Claude Code
├── src/humanizeai_cli/
│   ├── __init__.py                # Public package API
│   ├── __main__.py                # Enables `python -m humanizeai_cli`
│   ├── cli.py                     # CLI parser, batch runner, entry point
│   ├── client.py                  # HTTP client, retries, error mapping
│   ├── chunking.py                # Paragraph/sentence-aware text splitting
│   ├── cookies.py                 # Local Chromium/Firefox cookie import
│   ├── curl.py                    # DevTools "Copy as cURL" parser
│   ├── errors.py                  # Custom exception hierarchy
│   ├── session.py                 # Session file storage & token TTL cache
│   └── tokens.py                  # Clipboard polling, extraction & prompts
├── tests/                         # Unit tests (stdlib unittest, no network required)
├── examples/                      # Sample input text
├── AGENTS.md                      # Operating guide for AI agents
├── CONTRIBUTING.md                # Development & PR guidelines
└── pyproject.toml                 # Packaging & tool configuration

Running Tests

The test suite uses Python's built-in unittest module and a local stub HTTP server, without accessing any network or installing external packages:

python3 -m unittest -v

Troubleshooting

Symptom Cause Fix
no cookie available Browser has never visited the site, or cookie DB is inaccessible Open humanizeai.pro once in your browser, or run with --from-curl
No turnstile token available Token expired or not yet cached Rerun with --wait-token and copy a /api/process cURL
turnstileFailure='timeout' Cloudflare widget did not complete in the browser Reload humanizeai.pro, pause ad blockers, wait a few seconds, and retry
HTTP 403 Token rejected or expired Copy a fresh /api/process cURL
HTTP 429 Rate limited by upstream service Wait a few minutes before continuing

Disclaimer

This software is not an official client and is not associated with or endorsed by humanizeai.pro in any way. Follow the service's terms of use and rate limits. Do not use it to process code, JSON, or LaTeX blocks, since non-prose syntax will be rewritten.

License

Released under the MIT License.

About

AI to human text, which you can use with your antigravity, codex, and claude-code and dont worry its free, have fun.

Topics

Resources

Contributing

Stars

5 stars

Watchers

0 watching

Forks

Contributors

Languages