A local retry proxy for Anthropic-compatible Claude endpoints. It sits between Claude Code and an upstream API, retries temporary failures, and supports both CC-Switch provider discovery and direct API configuration.
Claude Code -> http://127.0.0.1:18080 -> upstream API
- Retries temporary HTTP failures, network errors, timeouts, JSON error payloads,
and SSE
event: errorresponses. - Reads an existing Claude provider from CC-Switch without exporting its token.
- Supports a direct upstream URL without requiring CC-Switch.
- Can translate Claude Messages requests to OpenAI Responses for a GPT model selected from a local CC-Switch Codex provider.
- Preserves the client's requested model and beta headers by default.
- Binds to
127.0.0.1by default and redacts common secret formats in logs. - Uses only the Python standard library at runtime.
Download the latest anyrouter-claude-retry-proxy-*-windows-x64.zip from the
GitHub Releases page and extract it. The release contains a standalone EXE, so
Python is not required.
Open PowerShell in the extracted directory:
.\setup.ps1
.\start-claude-via-retry-proxy.ps1setup.ps1 offers three modes:
- CC-Switch: select an existing non-local Claude provider. The proxy reads its upstream URL and authentication from the local CC-Switch database.
- Direct API: enter the upstream API URL. Existing Claude authentication
headers are forwarded to that upstream, or you can set
ANYROUTER_CLAUDE_AUTH_TOKENas an explicit override. - Codex Responses: select a local CC-Switch Codex provider whose upstream speaks OpenAI Responses. Claude Code remains the local client; the proxy translates its Messages requests and Responses output to Claude shapes.
The generated config.local.psd1 contains endpoint choices but no API token.
It is excluded by .gitignore.
Configure the endpoint:
.\setup.ps1 -Mode direct -UpstreamBaseUrl https://anyrouter.topUse the same authentication variable that your Claude setup normally uses:
$env:ANTHROPIC_AUTH_TOKEN = "your-token"
.\start-claude-via-retry-proxy.ps1The launcher sets ANTHROPIC_BASE_URL only for its Claude process. It does not
persist environment variables or modify global Claude settings.
CC-Switch normally stores its database at:
%USERPROFILE%\.cc-switch\cc-switch.db
Run interactive setup and choose the source provider:
.\setup.ps1 -Mode cc-switchThe proxy can be used directly through the included Claude launcher. Installing a separate provider entry inside CC-Switch is optional:
.\manage.ps1 install-providerTo use a GPT-compatible model from CC-Switch, run setup and choose Codex Responses:
.\setup.ps1 -Mode codex
.\manage.ps1 start
.\start-claude-via-retry-proxy.ps1The setup script only records the Codex provider ID, name, and model in
config.local.psd1; it reads the provider endpoint and key at runtime from
CC-Switch. The proxy sends POST /v1/responses upstream and returns a Claude
Messages response to Claude Code. Streaming requests are translated from
Responses SSE events as well.
.\manage.ps1 start
.\manage.ps1 status
.\manage.ps1 test
.\manage.ps1 logs
.\manage.ps1 stop
.\manage.ps1 restart
.\manage.ps1 configDefaults:
- Listen URL:
http://127.0.0.1:18080 - Retry limit: unlimited (
MaxRetries = 0) - Retry delay: 0.25 seconds, capped at 2 seconds
- Retried 4xx statuses:
408,409,425, and429 - Retried 5xx statuses: selected common temporary and Cloudflare statuses
- Model rewriting: disabled
- Added
anthropic-beta: disabled Retry-After: ignored unless enabled
To retry every 4xx response, use -RetryAll4xx or set it in the local config.
This is not the default because authentication and permission failures should
return immediately.
Copy config.example.psd1 to config.local.psd1, or rerun setup.ps1. Command
line parameters override values in the local config.
Examples:
.\manage.ps1 start -MaxRetries 100
.\manage.ps1 start -RespectRetryAfter
.\manage.ps1 start -ForceModel your-upstream-model
.\manage.ps1 start -AnthropicBeta your-beta-name
.\manage.ps1 start -UpstreamProxyUrl http://127.0.0.1:7890Skipping Claude Code permission checks is never enabled by default. To request that behavior explicitly:
.\start-claude-via-retry-proxy.ps1 -DangerouslySkipPermissionsRequirements:
- Python 3.10 or newer for Claude/Direct modes; Codex Responses mode requires
Python 3.11 or newer (
tomllib). - Windows PowerShell 5.1 or PowerShell 7
git clone https://github.com/My15sir/any.git
cd any
.\setup.ps1
.\start-claude-via-retry-proxy.ps1Run tests:
python -m unittest discover -s tests -v- Keep the listener on
127.0.0.1unless you intentionally need remote access. - Do not commit
config.local.psd1,.env, CC-Switch databases, logs, or keys. - Error logs can contain upstream diagnostic text. Review logs before sharing.
- The proxy does not send telemetry and does not persist request bodies.
MIT. See LICENSE.