PHhTTPS commited on
Commit
d346ea2
·
1 Parent(s): 413d674

feat(cli): Implement p-claude and p-code aliases

Browse files
Files changed (1) hide show
  1. examples/cli-config/proxy-tools.rc +40 -0
examples/cli-config/proxy-tools.rc ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # CLIProxyAPI Plus - Shell Helper Functions
2
+ # Source this file in your .bashrc or .zshrc to use proxy-aware aliases.
3
+ # Usage: source path/to/proxy-tools.rc
4
+
5
+ # --- Configuration ---
6
+ # You can override these variables before sourcing if needed.
7
+ : "${PROXY_BASE_URL:=http://localhost:7860/v1}"
8
+ : "${ANTHROPIC_PROXY_KEY:=your-api-key}"
9
+ : "${OPENAI_PROXY_KEY:=your-api-key}"
10
+
11
+ # --- Helper Functions ---
12
+
13
+ # Run Claude Code through the proxy
14
+ p-claude() {
15
+ echo "Starting Claude Code via CLIProxyAPI Plus..."
16
+ # We use a subshell (parentheses) to localize the export, ensuring
17
+ # it doesn't pollute the current shell session.
18
+ (
19
+ export ANTHROPIC_BASE_URL="${PROXY_BASE_URL}"
20
+ export ANTHROPIC_API_KEY="${ANTHROPIC_PROXY_KEY}"
21
+
22
+ # Execute the original claude command with arguments
23
+ claude "$@"
24
+ )
25
+ }
26
+
27
+ # Run Open Interpreter through the proxy
28
+ p-code() {
29
+ echo "Starting Open Interpreter via CLIProxyAPI Plus..."
30
+ (
31
+ # Open Interpreter respects these for OpenAI-compatible usage
32
+ export OPENAI_API_BASE="${PROXY_BASE_URL}"
33
+ export OPENAI_API_KEY="${OPENAI_PROXY_KEY}"
34
+
35
+ # Some versions also look for specific flags, but env vars are cleaner
36
+ interpreter "$@"
37
+ )
38
+ }
39
+
40
+ echo "Loaded CLIProxyAPI aliases: p-claude, p-code"