Anthropic strips programmatic mode from Pro/Max — the node-pty + tmux workaround
Mike Codeur
![]()
Anthropic is once again stripping benefits from the Pro and Max plans.
Starting June 15, 2026, Claude Code's programmatic mode moves to API billing. Full token pricing, no subscription coverage. It is the logical next step in a series of restrictions that silently hits anyone building around Claude Code.
For developers using Claude Code interactively, by hand, nothing changes. For those automating, the bill stacks up fast.
What actually changes on June 15
Anthropic splits Claude Code billing into two distinct pools.
The subscription pool (Pro, Max 5x, Max 20x) only covers interactive mode: the claude binary running in a terminal, with a human at the keyboard.
The Agent SDK credits pool covers everything else: claude -p, the Agent SDK, GitHub Actions, crons, scheduled tasks, and any pipeline piloting Claude without a human in the loop.
| Plan | Free Agent SDK credits per month |
|---|---|
| Pro | $20 |
| Max 5x | $100 |
| Max 20x | $200 |
Once free credits are spent, the bill keeps adding up at full API price. No soft cap, no warning, no forced pause.
Who is affected and who is not
The change creates two distinct worlds.
Interactive users: if your Claude Code usage is opening a terminal, launching claude, and chatting with it to code, nothing changes. Your Max subscription covers everything as before.
Builders and every agentic pipeline: if you build around Claude Code, the bill moves to the API pool.
The affected list includes:
- Agentic OS solutions built on Claude Code (OpenClaw, AgentOS, Quivr 247)
- Remote control solutions like Hermes
- Any cron or scheduled task running
claude -p - CI/CD pipelines calling Claude
- Any tool piloting Claude without a TTY (stdin pipe, headless)
The painful part is that the switch is silent. You run your script as usual, it works, and the bill grows in the background.
The scary example: $1,800 in two days
A developer documented on GitHub receiving an $1,800 bill in two days, simply because he left a claude -p cron running every hour. His ANTHROPIC_API_KEY was exported in his environment, and Claude silently switched to the API pool with no warning whatsoever.
Multiply by the number of forgotten crons scattered across servers and the total compounds quickly.
Why it works that way: TTY detection
The toggle between interactive and programmatic happens on the client side, inside the Claude Code binary, not on Anthropic's servers.
At startup, Claude checks whether its stdin and stdout are connected to a real terminal (TTY).
- TTY detected → interactive mode → subscription OAuth token
- No TTY → programmatic mode → API token
That client-side detection is exactly what opens the door to the workaround.
The fix: node-pty + tmux
If detection happens on the client side, all you need is to hand Claude a real terminal from your code, and Claude stays on the subscription pool.
Two building blocks make this clean.
node-pty
node-pty is an official Node library maintained by Microsoft. It powers the integrated terminals in VS Code, Hyper, and most "terminal-in-an-app" products.
It exposes a simple API:
import * as pty from 'node-pty';
const shell = pty.spawn('claude', [], {
name: 'xterm-256color',
cols: 200,
rows: 50,
cwd: process.cwd(),
env: { ...process.env, TERM: 'xterm-256color' }
});
shell.onData((data) => process.stdout.write(data));
shell.write("Write me a hello world in Rust\r");Five useful lines. Claude launches inside a real pseudo-terminal. It sees a TTY. It stays in interactive mode. It bills the subscription.
tmux
tmux is a terminal session server, separate from the Node process. It runs at the system level, owned by init or systemd.
The benefit: if your Node process crashes, if your SSH drops, if the machine reboots, the Claude session running inside tmux keeps going. You reconnect later with tmux attach and find yourself exactly where you left off.
This is precisely what Claude Code's claude -p did before June 15, minus the API bill.
When to pick node-pty or tmux

The simple rule:
| Context | Best fit | Why |
|---|---|---|
| Local MVP, fast iteration | node-pty | Simple to code, direct live stream via onData |
| Production, VPS, long-lived sessions | tmux | Sessions survive crashes, reconnect from anywhere |
| Next.js pipeline with UI | node-pty + tmux | Best of both worlds |
In practice, serious solutions (Quivr 247, AgentOS, OpenClaw) combine the two.
Full architecture of a PTY agent
For a production-ready setup with a real-time UI, here is the architecture you find everywhere.
- Browser sends a POST to the backend with the prompt
- Next.js API route gets or starts the PTY for this agent
- PTY Manager maintains an in-memory
Map<agent_id, runtime> - Child PTY launches
claudein a real pseudo-terminal - Claude writes its transcript to
~/.claude/projects/.../sid.jsonl, which becomes the single source of truth - JSONL Tail reads the appended file every 400 ms
- SSE endpoint broadcasts each new line to connected clients
- EventSource on the browser refreshes the UI in real time
The key trick: never drive React state from pty.onData. Drive it from Claude's JSONL. This gives you three essential properties:
- Survives Next.js HMR (the tail resumes from its offset)
- Multiple clients can connect to the same tail
- Consistency with
claude /resume, which already uses this JSONL
Honest loophole limits
Let me be straight here. This solution is a workaround, not an officially blessed path.
Precarious loophole. Anthropic can add an extra check at any moment: parent process verification, device fingerprint, timing patterns. Nothing guarantees this lasts six months.
Subscription limits still apply. You stay capped by Max's 5-hour windows. You change billing pool, not capacity.
No structured output. No --json-schema, no programmatic tool callbacks. You read raw terminal text. Pipelines that need structured output have to parse client-side.
OAuth one-shot required. claude login must have run once on the machine so the token sits in the keychain.
Recap
Anthropic did not kill programmatic mode. They simply moved it to a separate billing pool, charged at full token price.
To keep automating Claude Code without touching that pool, two technical tools are enough: node-pty for the real pseudo-terminal, tmux for persistence. This is exactly what every serious Agentic OS solution has been using quietly for weeks.
In today's video, I cover the full architecture, the minimal code to set it up, and the honest limits of the loophole.
🎁 Download the PTY Toolkit — the 2 ready-to-paste prompts for Claude Code (minimal version and full Next.js version), the editable excalidraw diagram, and the OAuth verification checklist.
📩 The Agentic Dev newsletter — every week, the Claude Code workflows and tools I actually use.