Spaces:
Sleeping
Sleeping
| # 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 <<EOF | |
| Installed CLIProxyAPI ${VERSION} under ${DEST} | |
| Next steps: | |
| 1. Edit ${DEST}/config.yaml β set the 'api-keys:' list to a secret of your | |
| choosing (the agent runners read CLIPROXYAPI_KEY which must match). | |
| 2. OAuth-login each upstream you intend to use, e.g.: | |
| cd ${DEST} | |
| ./cli-proxy-api --config config.yaml login claude | |
| ./cli-proxy-api --config config.yaml login codex | |
| The resulting token JSONs land in ~/.cli-proxy-api/ by default. | |
| 3. Start the proxy in the background: | |
| cd ${DEST} | |
| nohup ./cli-proxy-api --config config.yaml > 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=<the api-key you set in step 1> | |
| EOF | |