#!/bin/bash
export LC_ALL=C
P=http://172.19.0.1:20808

echo "===== DIRECT FROM SERVER (Iranian IP) ====="
for u in "https://models.opencode.ai/api.json" "https://opencode.ai/zen/v1/models" "https://api.opencode.ai/v1/models" "https://opencode.ai/api/models"; do
  printf '  %-45s ' "$u"
  curl -s -o /dev/null -w '%{http_code} %{time_total}s\n' --max-time 12 "$u" 2>/dev/null
done

echo
echo "===== THROUGH THE PROXY ====="
for u in "https://models.opencode.ai/api.json" "https://opencode.ai/zen/v1/models" "https://api.opencode.ai/v1/models" "https://opencode.ai/api/models"; do
  printf '  %-45s ' "$u"
  curl -s -o /tmp/oc_body -w '%{http_code} %{time_total}s ' --max-time 20 -x "$P" "$u" 2>/dev/null
  head -c 80 /tmp/oc_body 2>/dev/null | tr -d '\n'; echo
done
