#!/usr/bin/env bash # Install CLIProxyAPI binary + scaffold config under agents/cliproxyapi/_vendor/. # Re-run any time to upgrade. Linux x86_64 only here; adjust BINARY_NAME for # other platforms (see github.com/router-for-me/CLIProxyAPI/releases). # # Override the release with: CLIPROXYAPI_VERSION=v0.5.2 bash install.sh set -euo pipefail VERSION="${CLIPROXYAPI_VERSION:-v0.5.2}" HERE="$(cd "$(dirname "$0")" && pwd)" DEST="${HERE}/_vendor" BINARY_NAME="cli-proxy-api-linux-amd64" URL="https://github.com/router-for-me/CLIProxyAPI/releases/download/${VERSION}/${BINARY_NAME}" mkdir -p "${DEST}" cd "${DEST}" if [[ -x ./cli-proxy-api ]]; then echo "cli-proxy-api already present at ${DEST}/cli-proxy-api (delete to force re-download)" else echo "Downloading ${URL}" curl -fL --retry 3 -o cli-proxy-api "${URL}" chmod +x cli-proxy-api fi if [[ ! -f config.yaml ]]; then cp ../config.example.yaml config.yaml echo "Copied agents/cliproxyapi/config.example.yaml → _vendor/config.yaml" echo " → Edit the 'api-keys:' list before first use." fi cat < proxy.log 2>&1 & 4. (Optional) Start the max_tokens-clamp passthrough used by aibuildai: cd ${HERE%/cliproxyapi}/.. # repo root .venv/bin/python -m agents.cliproxyapi.clamp_proxy & 5. export CLIPROXYAPI_KEY= EOF