Thin proxy that fixes OAuth token handling for Anthropic API. Two modes via PROXY_MODE env var.
Regular mode (default): client provides its own token; proxy fixes OAuth headers and translates OpenAI→Anthropic.
- Moves
sk-ant-oattokens fromx-api-keytoAuthorization: Bearer - Injects required OAuth headers + Claude Code system prompt
- Translates OpenAI
/v1/chat/completions→ Anthropic/v1/messages - Serves
/v1/modelsfor SillyTavern model discovery
Billing mode (PROXY_MODE=billing): proxy stores its own Claude Code OAuth token and routes every request through your Claude subscription (instead of pay-per-token). Includes 8 layers of detection bypass adapted from zacdcook/openclaw-billing-proxy:
- Billing fingerprint header injection (per-request SHA256)
- String trigger sanitization (OpenClaw, sessions_*, etc.)
- Tool name renames (29 OpenClaw tools → CC PascalCase)
- System-prompt template strip + paraphrase
- Tool description strip + CC tool-stub injection
- Property-name renames (session_id, agent_id, etc.)
- Bidirectional reverse mapping (SSE + JSON)
- Trailing assistant-prefill strip
Token usage is logged for every request: [USAGE] model=X in=Y out=Z.
cd /path/to/this/directory
docker build -t anthropic-proxy .
docker run -d \
--name anthropic-proxy \
--restart unless-stopped \
--network custom \
-p 4010:4010 \
anthropic-proxy- Go to Docker tab → Add Container
- Name:
anthropic-proxy - Repository: (use the built image or point to a registry)
- Network:
custom - Port:
4010:4010 - Restart Policy:
unless-stopped
To route all traffic through your Claude subscription instead of API billing:
- Get your Claude Code OAuth token:
cat ~/.claude/.credentials.json(look foraccessToken) - Add env vars to the container:
PROXY_MODE=billingOAUTH_TOKEN=sk-ant-oat01-...(or mount~/.claudeas volume/root/.claude:ro)
- Restart the container
Clients connecting to the proxy in billing mode do not need to send a token — the proxy uses its stored one for everything.
docker run -d \
--name anthropic-proxy \
--restart unless-stopped \
-p 4010:4010 \
-e PROXY_MODE=billing \
-e OAUTH_TOKEN=sk-ant-oat01-... \
anthropic-proxyUpdate LiteLLM config to point Anthropic models at the container:
- API Base:
http://anthropic-proxy:4010(if on same Docker network) - Or
http://YOURIP:4010(if using host port mapping)
curl http://localhost:4010/health
curl http://localhost:4010/v1/models/health shows mode, subscription type (in billing mode), token expiry, and request totals.
Every request logs to stdout:
[USAGE] model=claude-sonnet-4-6 in=1234 out=567 | totals: req=42 in=51200 out=23400
Tail with docker logs -f anthropic-proxy | grep USAGE for billing visibility.