@wxyhjkd/claude-proxy
v1.0.7
Published
Claude CLI with configurable proxy support - route requests through custom domains
Maintainers
Readme
Claude Proxy
A configurable wrapper for @anthropic-ai/claude-code that allows you to use a custom proxy domain.
Installation
From npm (Recommended)
npm install -g @wxyhjkd/claude-proxyFrom Source
git clone https://github.com/wxyhjkd/claude-proxy.git
cd claude-proxy/modified-claude-code
npm install
npm link # This will override the global 'claude' commandCommands
After installation, this package provides two commands:
claude- Overrides the original claude command with proxy supportccproxy- Alternative command name for the same functionality
Configuration
Environment Variable (Recommended)
export CLAUDE_PROXY_DOMAIN="your-proxy-domain.com"
export CLAUDE_DEBUG="true" # Optional: enable debug loggingRequired Configuration
The CLAUDE_PROXY_DOMAIN environment variable is required. The package will not work without it.
Usage
CLI Usage
# Set proxy domain
export CLAUDE_PROXY_DOMAIN="my-proxy.example.com"
# Use modified claude command (overrides original)
claude "help me code"
# Or use ccproxy alias
ccproxy "help me code"Programmatic Usage
import { query } from './sdk.mjs';
// Set environment variable before importing
process.env.CLAUDE_PROXY_DOMAIN = "my-proxy.example.com";
// Use the modified SDK
for await (const chunk of query({ prompt: "Hello" })) {
console.log(chunk);
}How It Works
- Reads the original
@anthropic-ai/claude-codefiles - Replaces
api.anthropic.comwith your configured proxy domain - Creates a temporary modified version and executes it
Temporary Files
This package creates temporary files during execution:
- Location:
${tmpdir}/claude-proxy/claude-code@${version}/ - Contents: Modified CLI script and required assets (yoga.wasm, vendor folder)
- Cleanup: Files are kept by default for better performance (can be enabled)
- Purpose: Ensures the modified claude CLI has access to all necessary dependencies
- Enable Cleanup: Set
CLAUDE_PROXY_CLEANUP=trueto clean temp files on exit
Example temp directory: /tmp/claude-proxy/[email protected]/
Configuration Options
CLAUDE_PROXY_DOMAIN: Your proxy domain (required)CLAUDE_DEBUG: Set to "true" to enable debug logging (optional)CLAUDE_QUIET: Set to "true" to disable the proxy notification message (optional)CLAUDE_PROXY_CLEANUP: Set to "true" to enable temp file cleanup on exit (optional, default: disabled)
Examples
# Use different proxy domains
export CLAUDE_PROXY_DOMAIN="proxy1.example.com"
claude "write a function"
# Output: [Claude Proxy] Using proxy domain: proxy1.example.com
export CLAUDE_PROXY_DOMAIN="proxy2.example.com"
ccproxy "debug this code"
# Output: [Claude Proxy] Using proxy domain: proxy2.example.com
# One-liner usage
CLAUDE_PROXY_DOMAIN="my-proxy.com" claude "help me code"
# Quiet mode (no proxy notification)
CLAUDE_QUIET=true claude "help me code"
# Debug mode
CLAUDE_DEBUG=true claude "help me code"
# Enable temp file cleanup (files deleted on exit)
CLAUDE_PROXY_CLEANUP=true claude "help me code"