DEV Community

gentic news
gentic news

Posted on • Originally published at gentic.news

50-line script bypasses Anthropic's Claude pricing split for CI/CD

A 50-line Python script by developer HammerMei exploits Claude's interactive mode to bypass Anthropic's June 15 pricing split, keeping CI/CD calls on subscription billing instead of per-token API charges.

Developer HammerMei published a 50-line Python script on May 17 that exploits Claude's interactive mode to bypass Anthropic's June 15 pricing split. The trick keeps CI/CD calls on subscription billing instead of switching to per-token API pricing.

Key facts

  • 50 lines of Python code replace claude -p
  • June 15 pricing split triggers per-token API charges
  • Interactive session remains on subscription billing
  • Script uses kill $PPID to exit cleanly
  • Timeout and retry logic included for flaky LLM behavior

Anthropic's June 15 pricing change [per Anthropic] splits Claude usage into two billing tiers: claude -p calls in CI/CD pipelines will incur per-token API charges, while interactive sessions remain on the fixed subscription. Developer HammerMei published a 50-line Python script, claude_task.py, that exploits this gap.

The trick exploits a Claude behavior: running claude without the -p flag starts an interactive session that stays on subscription billing. The problem is that interactive mode doesn't exit after responding. HammerMei's solution appends a command to the prompt: "Write your response to: /tmp/response-abc123.txt. Then run in bash: kill $PPID." $PPID inside a bash subprocess is the PID of the claude process itself. Claude writes output to a file, kills its own process, and exits cleanly. The calling script reads the file.

The script, available on GitHub Gist, includes timeout and retry logic because Claude sometimes fails to follow instructions. The comparison table shows this approach requires zero setup versus the 3,000-line poor-claude daemon solution [per the dev.to post].

Why this matters

The unique angle is that Anthropic's pricing split creates an arbitrage opportunity for users willing to exploit a behavioral quirk. The company's June 15 change [per Anthropic's pricing page] was designed to monetize high-volume, automated usage — but the interactive session loophole undermines that intent. This isn't a vulnerability, but a failure to align billing incentives with actual usage patterns.

Caveats

The approach relies on Claude following instructions reliably, which it doesn't always do. The developer notes that "Claude is an LLM. It doesn't always follow instructions. The timeout + retry is there for a reason — treat it like any other flaky external call." This makes it unsuitable for production pipelines requiring deterministic output.

Cover image for claude -p alternative for CI/CD: a 50-line fix for June 15 Pricing Split

Historical context

Anthropic is projected to surpass OpenAI in annual recurring revenue by mid-2026 [per our June 30 report]. The company's pricing changes reflect a push to capture more value from heavy users. This script represents a grassroots resistance to that strategy, reminiscent of earlier hacks like the poor-claude project that built a persistent workspace [per our May 17 article].

What to watch

Watch for Anthropic's response: either a patch that blocks the kill command in interactive mode, or a revised pricing FAQ that closes the loophole. If the trick spreads widely, Anthropic may accelerate the timeline for deprecating subscription-based interactive sessions entirely.


Originally published on gentic.news

Top comments (0)