TUI wrapper for Claude Code with hot-swappable backend support and transparent API proxying.
Goal: Make switching between API providers effortless. Configure all your backends once, then switch between them with a single hotkey — no config edits, no restarts, no interruptions.
Note: Only Anthropic API-compatible backends are supported.
Claude Code is great, but sometimes you need a different provider — maybe Anthropic is down, rate-limited, or you want to use another Anthropic-compatible backend. Without AnyClaude, switching means editing config files or environment variables every time.
AnyClaude solves this:
- Configure all backends once
- Switch with
Ctrl+Bmid-session - No restarts, no config edits
- Hot-Swap Backends — Switch between providers without restarting Claude
- Session Context Preservation — Summarize conversation on backend switch (summarize mode)
- Transparent Proxy — Routes API requests through active backend
- Thinking Block Handling — Strip or summarize thinking blocks for cross-provider compatibility
- Live Configuration — Config hot reload on file changes
- Image Paste — Paste images from clipboard (Ctrl+V)
- Debug Logging — Request/response logging with configurable detail levels
┌─────────────────────────────┐
│ AnyClaude TUI │
└──────────────┬──────────────┘
│
┌──────▼──────┐
│ Claude Code │
└──────┬──────┘
│ ANTHROPIC_BASE_URL
┌──────▼──────┐
│ Local Proxy │
│ :8080 │
└──────┬──────┘
│
┌─────────┼─────────┐
▼ ▼ ▼
Backend1 Backend2 Backend3
cargo build --release./target/release/anyclaudeThe wrapper automatically:
- Starts a local proxy on
127.0.0.1:8080 - Sets
ANTHROPIC_BASE_URLenvironment variable - Spawns Claude Code in an embedded terminal
- Routes all API requests through the active backend
| Key | Action |
|---|---|
Ctrl+B |
Backend switcher popup |
Ctrl+S |
Status/metrics popup |
Ctrl+V |
Paste image from clipboard |
Ctrl+Q |
Quit |
1-9 |
Quick-select backend (in switcher) |
Config location: ~/.config/anyclaude/config.toml
[defaults]
active = "anthropic"
[[backends]]
name = "anthropic"
display_name = "Anthropic"
base_url = "https://api.anthropic.com"
auth_type = "passthrough" # Forward Claude Code's auth headers
[[backends]]
name = "alternative"
display_name = "Alternative Provider"
base_url = "https://your-provider.com/api"
auth_type = "bearer"
api_key = "your-api-key"[defaults]
active = "anthropic" # Default backend at startup
timeout_seconds = 300 # Overall request timeout
connect_timeout_seconds = 5 # TCP connection timeout
idle_timeout_seconds = 60 # Streaming response idle timeout
pool_idle_timeout_seconds = 90 # Connection pool idle timeout
pool_max_idle_per_host = 8 # Max idle connections per host
max_retries = 3 # Connection retry attempts
retry_backoff_base_ms = 100 # Base backoff for retries (exponential)
[proxy]
bind_addr = "127.0.0.1:8080" # Local proxy listen address
base_url = "http://127.0.0.1:8080"
[terminal]
scrollback_lines = 10000 # History buffer size
[thinking]
mode = "summarize" # "strip" or "summarize"
[thinking.summarize]
base_url = "https://your-summarizer-api.com" # Anthropic-compatible API
api_key = "your-summarizer-api-key" # API key for summarization
model = "your-model-name" # Model for summarization
max_tokens = 500 # Max tokens in summary
[debug_logging]
enabled = true
level = "verbose" # "basic", "verbose", or "full"
path = "~/.config/anyclaude/debug.log"
[[backends]]
name = "anthropic"
display_name = "Anthropic"
base_url = "https://api.anthropic.com"
auth_type = "passthrough" # Forward Claude Code's auth headers
[[backends]]
name = "alternative"
display_name = "Alternative Provider"
base_url = "https://your-provider.com/api"
auth_type = "bearer"
api_key = "your-api-key"
[[backends]]
name = "custom"
display_name = "Custom Provider"
base_url = "https://my-proxy.example.com"
auth_type = "passthrough" # Forward original auth headers| Type | Header | Use Case |
|---|---|---|
api_key |
x-api-key: <value> |
Anthropic API |
bearer |
Authorization: Bearer <value> |
Most providers |
passthrough |
Forwards original headers | OAuth flows, custom auth |
When switching between providers, thinking blocks need special handling due to signature validation:
| Mode | Behavior | Backend Switch |
|---|---|---|
strip |
Removes all thinking blocks from requests | Instant, no context preserved |
summarize |
Summarizes session via external LLM on backend switch | Context preserved as summary |
Recommended: Use summarize mode for most cases — it preserves conversation context when switching backends.
[thinking]
mode = "strip"Completely removes thinking blocks from message history. Fast and stable, but loses thinking context between turns.
[thinking]
mode = "summarize"
[thinking.summarize]
base_url = "https://your-summarizer-api.com" # Anthropic-compatible API
api_key = "your-summarizer-api-key" # API key for summarization
model = "your-model-name" # Model for summarization
max_tokens = 500 # Max tokens in summaryWhen you switch backends:
- Current session history is summarized via the configured LLM
- Summary is prepended to the first message on the new backend
- New backend receives context:
[CONTEXT FROM PREVIOUS SESSION]...[/CONTEXT FROM PREVIOUS SESSION]
This allows seamless backend switching while preserving conversation context.
Enable detailed request/response logging for debugging:
[debug_logging]
enabled = true
level = "verbose" # "basic" | "verbose" | "full"
path = "~/.config/anyclaude/debug.log"| Level | Content |
|---|---|
basic |
Request timestamps, status codes, latency |
verbose |
+ Token counts, model info, cost estimates |
full |
+ Request/response body previews, headers |
Apache 2.0