File size: 2,007 Bytes
f606b10
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/bash
# CLIProxyAPIPlus Quick Access Script
# Usage: ./proxy <command>

BASE_URL="http://localhost:8317/v1"
API_KEY="sk-client-key-1"

case "$1" in
  models|m)
    echo "πŸ“‹ Available Models:"
    curl -s -H "Authorization: Bearer $API_KEY" "$BASE_URL/models" | jq -r '.data[].id'
    ;;
  test|t)
    echo "πŸ§ͺ Testing Proxy..."
    curl -s -H "Authorization: Bearer $API_KEY" \
      -H "Content-Type: application/json" \
      -d '{"model":"gemini-2.5-pro","messages":[{"role":"user","content":"Hello from CLIProxyAPIPlus!"}]}' \
      "$BASE_URL/chat/completions" | jq -r '.choices[0].message.content'
    ;;
  status|s)
    echo "πŸ” Server Status:"
    curl -s http://localhost:8317/ | jq .
    ;;
  auth|a)
    echo "πŸ”‘ Configured Accounts:"
    ls -lh ~/.cli-proxy-api/
    ;;
  logs|l)
    echo "πŸ“ Recent Logs:"
    tail -30 ~/CLIProxyAPIPlus/server.log
    ;;
  start)
    echo "▢️ Starting CLIProxyAPIPlus..."
    cd ~/CLIProxyAPIPlus && nohup ./cli-proxy-api-plus -config config.yaml > server.log 2>&1 &
    sleep 2
    echo "βœ… Server started on http://localhost:8317"
    ;;
  stop)
    echo "⏹️ Stopping CLIProxyAPIPlus..."
    killall cli-proxy-api-plus
    echo "βœ… Server stopped"
    ;;
  restart|r)
    echo "πŸ”„ Restarting CLIProxyAPIPlus..."
    ~/CLIProxyAPIPlus/proxy stop
    sleep 2
    ~/CLIProxyAPIPlus/proxy start
    ;;
  *)
    echo "CLIProxyAPIPlus Quick Access"
    echo ""
    echo "Commands:"
    echo "  models|m    - List available models"
    echo "  test|t      - Send test request"
    echo "  status|s    - Check server status"
    echo "  auth|a       - Show configured accounts"
    echo "  logs|l       - View recent logs"
    echo "  start        - Start proxy server"
    echo "  stop         - Stop proxy server"
    echo "  restart|r    - Restart proxy server"
    echo ""
    echo "Examples:"
    echo "  ~/CLIProxyAPIPlus/proxy models"
    echo "  ~/CLIProxyAPIPlus/proxy test"
    echo "  ~/CLIProxyAPIPlus/proxy auth"
    ;;
esac