A local HTTP proxy that sits between Claude Code and the Anthropic API. It rewrites the system prompt and tool descriptions before forwarding — letting you swap in custom personalities, tone, style instructions, or patch tool behavior.
curl -sL https://raw.githubusercontent.com/anish749/anthropic-proxy/main/install.sh | bashThis downloads the latest release and installs to ~/.local/bin/anthropic-proxy. Override the install directory with INSTALL_DIR:
curl -sL https://raw.githubusercontent.com/anish749/anthropic-proxy/main/install.sh | INSTALL_DIR=/usr/local/bin bashOr build from source:
git clone https://github.com/anish749/anthropic-proxy.git
cd anthropic-proxy
go build -ldflags="-s -w" -o anthropic-proxy .anthropic-proxy --port 8080Then start Claude Code pointing at the proxy:
ANTHROPIC_BASE_URL=http://localhost:8080 claude| Command | Description |
|---|---|
| (default) | Start the proxy server |
login |
Log in via Anthropic OAuth |
Run anthropic-proxy --help or anthropic-proxy <command> --help for details.
| Flag | Default | Description |
|---|---|---|
--port |
8080 |
Port to listen on |
--log |
false |
Log every request to the requests/ directory |
--log-format |
json |
Output format for logged requests (json, yaml) |
--swap-creds |
false |
Replace client credentials with logged-in OAuth token |
All *.yaml files in prompts/ are loaded and merged at startup. Every rule uses the same schema with a type field to distinguish between system prompt and tool description replacements. You can organize rules across as many files as you like — split by concern, keep everything in one file, whatever works for you.
Files matching *replacements.local.yaml are gitignored for local overrides.
- type: system # or "tool"
block: 2 # system: which prompt block to target
tool: Bash # tool: which tool name to target
find: "text to find"
replace: "replacement"
regex: false # tool: treat find as a regex (default: false)
disabled: false # skip this rule (default: false)
warn_after: 5 # warn if unmatched after N evals (default: never)Find-and-replace within a system prompt block by index:
- type: system
block: 2
find: "Your responses should be short and concise."
replace: "You are a friendly pirate. Respond in pirate speak."Full replacement files (prompts/system-{i}-replace.txt) are also supported and take precedence over find-and-replace rules for the same block.
Patch tool descriptions before they reach the model:
- type: tool
tool: Bash
find: "# Creating pull requests\n..."
replace: "# Creating pull requests\n..."
- type: tool
tool: Bash
regex: true
warn_after: 5
find: "Co-Authored-By: Claude .+ <noreply@anthropic\\.com>"
replace: ""Multiple rules can target the same tool and are applied in order.
The Claude Code system prompt is an array of text blocks. Typically:
| Index | Content |
|---|---|
| 0 | Billing metadata |
| 1 | Identity intro |
| 2 | Main instructions, tone, and style |
| 3 | Memory and environment |
Blocks 0 and 1 are generally left unchanged. Blocks 2 and 3 are where personality and style live.
Unmatched find strings log a warning correlated with the upstream Request-Id. Tool rules track match stats and log a summary every 50 requests. Invalid YAML is a fatal startup error.
Opt-in with the --log flag:
anthropic-proxy --port 8080 --logEach API call creates files in requests/ named {timestamp}-{request-id}-{model}-{part}.json:
tools.json— tool definitionsmessages.json— conversation messagessystem.json— system promptsystem-reminders.json—<system-reminder>blocks extracted from user messages (if any)usage.json— token usage from the response
Without --log, requests are still logged automatically when rewrite rules produce warnings, for debugging.
To use the proxy with credential swapping (replacing your client's API key with an OAuth token):
anthropic-proxy login
anthropic-proxy --swap-creds