ProxyCLI / examples /cli-config /proxy-tools.rc
PHhTTPS's picture
feat(cli): Implement p-claude and p-code aliases
d346ea2
# CLIProxyAPI Plus - Shell Helper Functions
# Source this file in your .bashrc or .zshrc to use proxy-aware aliases.
# Usage: source path/to/proxy-tools.rc
# --- Configuration ---
# You can override these variables before sourcing if needed.
: "${PROXY_BASE_URL:=http://localhost:7860/v1}"
: "${ANTHROPIC_PROXY_KEY:=your-api-key}"
: "${OPENAI_PROXY_KEY:=your-api-key}"
# --- Helper Functions ---
# Run Claude Code through the proxy
p-claude() {
echo "Starting Claude Code via CLIProxyAPI Plus..."
# We use a subshell (parentheses) to localize the export, ensuring
# it doesn't pollute the current shell session.
(
export ANTHROPIC_BASE_URL="${PROXY_BASE_URL}"
export ANTHROPIC_API_KEY="${ANTHROPIC_PROXY_KEY}"
# Execute the original claude command with arguments
claude "$@"
)
}
# Run Open Interpreter through the proxy
p-code() {
echo "Starting Open Interpreter via CLIProxyAPI Plus..."
(
# Open Interpreter respects these for OpenAI-compatible usage
export OPENAI_API_BASE="${PROXY_BASE_URL}"
export OPENAI_API_KEY="${OPENAI_PROXY_KEY}"
# Some versions also look for specific flags, but env vars are cleaner
interpreter "$@"
)
}
echo "Loaded CLIProxyAPI aliases: p-claude, p-code"