#!/usr/bin/env bash # Cline connectivity smoke — 30-second self-check for a WindsurfAPI gateway # against the OpenAI-Compatible contract Cline uses. Prints PASS/FAIL per probe. # # BASE_URL="https:///v1" API_KEY="" MODEL="swe-1-6-slow" \ # bash scripts/cline-smoke.sh # # NOTE: BASE_URL must include the /v1 suffix (same as the Cline setting). # Requires: curl. Exit 0 = all probes passed, 1 = a probe failed. set -u BASE_URL="${BASE_URL:-http://127.0.0.1:3003/v1}" API_KEY="${API_KEY:-test}" MODEL="${MODEL:-swe-1-6-slow}" BASE_URL="${BASE_URL%/}" pass=0; fail=0 ok() { echo -e " \033[32mPASS\033[0m $1"; pass=$((pass+1)); } bad() { echo -e " \033[31mFAIL\033[0m $1"; fail=$((fail+1)); } auth=(-H "Authorization: Bearer ${API_KEY}" -H "Content-Type: application/json") echo "Cline smoke → ${BASE_URL} (model=${MODEL})" # 1. GET /v1/models models="$(curl -s --max-time 30 "${auth[@]}" "${BASE_URL}/models")" if echo "$models" | grep -q '"object"[[:space:]]*:[[:space:]]*"list"'; then n="$(echo "$models" | grep -o '"id"' | wc -l | tr -d ' ')" ok "GET /models (${n} entries)" else bad "GET /models — no {object:list} (got: $(echo "$models" | head -c 160))" fi # 2. Non-stream chat chat="$(curl -s --max-time 60 "${auth[@]}" "${BASE_URL}/chat/completions" -d "$(cat <