What if you could programmatically send prompts to Claude Code, Gemini CLI, or OpenAI Codex without setting up API keys or paying per-token? OAuth CLI Coder does exactly that by driving the actual CLI tools you already have installed and authenticated.
The trick is clever: instead of hitting an API, the tool launches a detached tmux session (a terminal multiplexer that runs in the background) with a large virtual terminal, runs the CLI binary inside it, and automates the text-based interface. It sends your prompts via tmux buffers, navigates past startup dialogs and trust prompts automatically, and captures the full scrollback output.
How It Works in Practice
Install with pip install oauth-cli-coder (you need tmux installed), then:
oauth-coder ask claude "refactor this function"sends a one-off promptoauth-coder ask claude "prompt" --session-id myprojectkeeps a persistent session with conversation contextoauth-coder listshows active sessionsoauth-coder stop-allcleans everything up
There's also a Python API with provider classes (ClaudeProvider, GeminiProvider, CodexProvider) for building more complex automations. Because sessions are independent, you can chain multiple agents together where one's output feeds into another.
The Tradeoffs
This approach has real limitations. You're screen-scraping a terminal UI, which means it's inherently more fragile than a proper API integration. If Claude Code changes its startup dialog or output formatting, the tool breaks until updated. Response capture depends on polling and heuristics rather than structured data.
But the appeal is obvious: if you're already paying for Claude Pro or have OAuth access to these tools, you can automate them without additional API costs. For personal scripts, CI integrations on small projects, or chaining multiple coding agents together in a pipeline, it's a practical workaround.
The project requires Python 3.12+ and is open-source. It's a Linux and macOS tool by nature since it depends on tmux, though WSL would work on Windows.