By dishishshawn
Local proxy that makes Anthropic SDK calls hit your Claude Code session instead of the real API. Uses your Max/Pro subscription, not API credits.
Stop burning API credits while you're testing your AI SaaS locally.
claude-fake-api is a Claude Code plugin that runs a local HTTP server on your machine that speaks the Anthropic Messages API. When your app calls it, the request gets forwarded — via the Claude Agent SDK — to your logged-in Claude Code session. That means the call is billed against your Claude Max / Pro subscription, not your API key.
Flip one env var. Keep coding.
You're building a SaaS that uses Claude. Every time you test a PDF extractor, a chat feature, or a prompt change locally, you burn API credits. For exploratory work, that's annoying. For hot reload + iterate loops, it's painful.
With claude-fake-api running, your dev environment points at http://localhost:8787 instead of https://api.anthropic.com. The exact same SDK code works — it just goes through your Claude subscription.
This is for local development only. Do not point production traffic at this. It's a convenience tool, not an API replacement.
POST /v1/messages — text-only messages, streaming + non-streaminganthropic Python + Node SDKs (set ANTHROPIC_BASE_URL)model passthrough (Opus / Sonnet / Haiku)tool_use / tool_result blocks)Unsupported requests return a clear 400 explaining what's missing.
As a Claude Code plugin (recommended):
/plugin marketplace add dishishshawn/claude-fake-api
/plugin install claude-fake-api@claude-fake-api
The first time you run /fake-api start, the plugin will auto-install its npm dependencies (one-time, ~5 seconds).
Or clone and run standalone (no Claude Code plugin system):
git clone https://github.com/dishishshawn/claude-fake-api.git
cd claude-fake-api
npm install
node src/cli.mjs start
Inside Claude Code:
/fake-api start
Claude Code will print something like:
claude-fake-api started on port 8787 (pid 12345).
Set these in the terminal where your app runs:
export ANTHROPIC_BASE_URL=http://localhost:8787
export ANTHROPIC_API_KEY=sk-fake-any-value
Paste those exports into the terminal where your SaaS backend runs. Then do your normal thing — client.messages.create(...) will now route through your Claude subscription.
When you're done:
/fake-api stop
Or check what's running:
/fake-api status
┌─────────────────────┐ POST /v1/messages ┌──────────────────────┐
│ Your SaaS backend │ ─────────────────────▶ │ claude-fake-api │
│ (anthropic SDK) │ │ localhost:8787 │
└─────────────────────┘ └──────────┬───────────┘
│
translate req → │ query({...})
▼
┌──────────────────────┐
│ Claude Agent SDK │
│ (your Claude Code │
│ OAuth credentials) │
└──────────┬───────────┘
│
▼
Billed to Max/Pro sub
The proxy exposes the Anthropic Messages wire format. Under the hood it calls query() from @anthropic-ai/claude-agent-sdk, which reuses the OAuth token your claude CLI is already logged in with.
usage for billing math.end_turn. The underlying SDK doesn't surface max_tokens / stop_sequence in a way we can forward cleanly yet.MIT © dishishshawn
Own this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge. GitHub access is read-only (username + org membership).
Sign in to claimOwn this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge. GitHub access is read-only (username + org membership).
Sign in to claimBased on adoption, maintenance, documentation, and repository signals. Not a security audit or endorsement.
npx claudepluginhub dishishshawn/claude-fake-api --plugin claude-fake-apiComprehensive UI/UX design plugin for mobile (iOS, Android, React Native) and web applications with design systems, accessibility, and modern patterns
Standalone image generation plugin using Nano Banana MCP server. Generates and edits images, icons, diagrams, patterns, and visual assets via Gemini image models. No Gemini CLI dependency required.
Multi-model consensus engine integrating OpenAI Codex CLI, Gemini CLI, and Claude CLI for collaborative code review and problem-solving.
Write feature specs, plan roadmaps, and synthesize user research faster. Keep stakeholders updated and stay ahead of the competitive landscape.
Unified status line for Claude Code with multi-CLI (Claude, Codex, Gemini, z.ai) usage monitoring, context, rate limits, and cost tracking