- workspace: capmetro-monitor, github-notifications, model-selector - workspace-security: vt-monitor, monitor-unauthorized - workspace-home: cron-manager, monitor-unauthorized - extensions: vt-sentinel (VT-Sentinel plugin) Includes sync.sh for pull/push, README, AGENTS.md, .gitignore.
40 lines
1.1 KiB
Bash
Executable File
40 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# validate-model.sh — Validate that a model ID exists in the LLM proxy
|
|
# Usage: validate-model.sh <model-id>
|
|
# Exit 0 if valid, 1 if not found
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
|
|
if [[ $# -lt 1 ]]; then
|
|
echo "Usage: validate-model.sh <model-id>" >&2
|
|
echo "Example: validate-model.sh nanogpt/deepseek-chat" >&2
|
|
exit 1
|
|
fi
|
|
|
|
MODEL_ID="$1"
|
|
|
|
# Strip llm-proxy/ prefix if present (user might pass the openclaw.json format)
|
|
MODEL_ID="${MODEL_ID#llm-proxy/}"
|
|
|
|
# Get the live model list
|
|
available=$("$SCRIPT_DIR/list-models.sh" 2>/dev/null) || {
|
|
echo "ERROR: Could not fetch model list from LLM proxy" >&2
|
|
exit 1
|
|
}
|
|
|
|
if echo "$available" | grep -qxF "$MODEL_ID"; then
|
|
echo "✅ Model '$MODEL_ID' is available"
|
|
exit 0
|
|
else
|
|
echo "❌ Model '$MODEL_ID' NOT found in /v1/models" >&2
|
|
# Suggest close matches
|
|
partial=$(echo "$available" | grep -i "$(echo "$MODEL_ID" | sed 's|.*/||')" | head -5)
|
|
if [[ -n "$partial" ]]; then
|
|
echo "" >&2
|
|
echo "Did you mean one of these?" >&2
|
|
echo "$partial" | sed 's/^/ /' >&2
|
|
fi
|
|
exit 1
|
|
fi
|