File size: 1,310 Bytes
d346ea2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# 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"
|