33 lines
861 B
Bash
Executable File
33 lines
861 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
BASE_URL="${BASE_URL:-http://127.0.0.1:8787}"
|
|
AUTH_TOKEN="${AUTH_TOKEN:-}"
|
|
|
|
AUTH_HEADER=()
|
|
if [[ -n "$AUTH_TOKEN" ]]; then
|
|
AUTH_HEADER=(-H "Authorization: Bearer ${AUTH_TOKEN}")
|
|
fi
|
|
|
|
echo "[1] health"
|
|
curl -sS "${BASE_URL}/health" | sed -n '1,3p'
|
|
|
|
echo "[2] models"
|
|
curl -sS "${BASE_URL}/v1/models" "${AUTH_HEADER[@]}" | sed -n '1,8p'
|
|
|
|
echo "[3] chat/completions"
|
|
curl -sS -X POST "${BASE_URL}/v1/chat/completions" \
|
|
-H 'Content-Type: application/json' \
|
|
"${AUTH_HEADER[@]}" \
|
|
-d '{"model":"whispergate-no-reply-v1","messages":[{"role":"user","content":"hello"}]}' \
|
|
| sed -n '1,20p'
|
|
|
|
echo "[4] responses"
|
|
curl -sS -X POST "${BASE_URL}/v1/responses" \
|
|
-H 'Content-Type: application/json' \
|
|
"${AUTH_HEADER[@]}" \
|
|
-d '{"model":"whispergate-no-reply-v1","input":"hello"}' \
|
|
| sed -n '1,20p'
|
|
|
|
echo "smoke ok"
|