claudesclaude
v1.1.1
Published
Local API proxy that mirrors the Anthropic Messages API by automating Claude's web UI with Puppeteer
Downloads
35
Maintainers
Readme
ClaudesClaude
Problem
You're building a local web app that needs LLM API access. But paying per-token through the Anthropic API adds up fast — especially for hobby projects, prototyping, or personal tools where you're iterating constantly. You're already paying for a Claude Pro/Max subscription, but there's no way to use it programmatically.
Solution
ClaudesClaude is a local API proxy that mirrors the Anthropic Messages API — but routes requests through your existing Claude subscription instead of the paid API. Your code talks to localhost:3456 using the same Anthropic SDK and request format it already uses. Just swap the baseURL and you're done. No API keys, no per-token billing.
Two modes:
| Mode | Command | Speed | Requires |
|---|---|---|---|
| CLI tunnel (default) | npx claudesclaude | ~3-5s per request | Claude Code CLI installed |
| Browser automation | npx claudesclaude --browser | ~15-30s per request | Google Chrome |
Quick Start
Default (CLI tunnel)
Pipes requests through the Claude Code CLI. No browser needed, instant startup.
npx claudesclaudeRequires claude CLI in your PATH. Install it from claude.ai/claude-code.
Browser Mode
Automates Claude's web UI with Puppeteer. Slower but works without the Claude Code CLI.
npx claudesclaude --browserOpens Chrome, navigates to claude.ai, waits for you to log in (first time only — session is persisted).
Usage
With the Anthropic SDK
import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic({
baseURL: "http://localhost:3456",
apiKey: "unused",
});
const response = await client.messages.create({
model: "claude-sonnet-4-20250514",
max_tokens: 1024,
messages: [{ role: "user", content: "Hello!" }],
});
console.log(response.content[0].text);With curl
curl -X POST http://localhost:3456/v1/messages \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-4-20250514",
"max_tokens": 256,
"messages": [{"role": "user", "content": "Hello!"}]
}'Streaming
curl -N -X POST http://localhost:3456/v1/messages \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-4-20250514",
"max_tokens": 256,
"stream": true,
"messages": [{"role": "user", "content": "Tell me a story."}]
}'API Endpoints
| Endpoint | Method | Description |
|---|---|---|
| /v1/messages | POST | Send a message (matches Anthropic API format) |
| /v1/models | GET | List available models |
| /health | GET | Check if the session is ready |
| /debug/screenshot | GET | PNG screenshot of browser (browser mode only) |
| /debug/info | GET | Current page URL and title (browser mode only) |
Environment Variables
| Variable | Default | Description |
|---|---|---|
| PORT | 3456 | API server port |
| HEADLESS | false | Run Chrome headless (browser mode only) |
| CHROME_PATH | auto-detected | Path to Chrome/Chromium (browser mode only) |
| CLAUDE_CLI_PATH | claude | Path to Claude Code CLI (CLI mode only) |
How It Works
CLI Tunnel Mode
- Receives an API request matching the Anthropic Messages format
- Spawns
claude -p --output-format jsonas a subprocess - Passes the prompt via stdin, reads structured JSON from stdout
- Returns the response in Anthropic API format
- For streaming: uses
--output-format stream-json --include-partial-messages
Browser Mode
- Launches your system Chrome via
puppeteer-core - Navigates to claude.ai and waits for login
- Persists session in
~/.claudesclaude/browser-data/ - For each request: opens a new conversation, pastes the message, waits for response
- Extracts response via network interception or DOM parsing
- Returns in Anthropic API format
Limitations
- CLI mode: Requires Claude Code CLI with an active subscription. Each request spawns a new process.
- Browser mode: Requests processed one at a time (~15-30s each). System prompts prepended as text. No image support. Claude.ai UI changes may break selectors.
- Both modes: Token counts may be estimates. Model selection maps to Claude CLI aliases (sonnet/opus/haiku).
Disclaimer: This tool may violate Anthropic's Terms of Service. Use at your own risk.
License
MIT
