| #!/bin/bash |
| |
| |
|
|
| 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 |
|
|