#!/bin/bash # CLIProxyAPIPlus Quick Access Script # Usage: ./proxy 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