#!/usr/bin/env bash
#
# AOCore chat-completion call via curl.
#
# Usage:
#   export AOSENTRY_KEY="sk-..."
#   bash chat-completion.sh
#
# Optional:
#   export AOSENTRY_BASE_URL="https://your-self-hosted-gateway"
#
# The -i flag prints response headers so you can see the six X-AOCore-*
# quota headers — see ../../rate-limits.md for what each one means.
set -euo pipefail

: "${AOSENTRY_KEY:?Set AOSENTRY_KEY to your minted API key (sk-...).}"

BASE_URL="${AOSENTRY_BASE_URL:-https://gateway.core.aocyber.ai}"

curl -i "${BASE_URL}/v1/chat/completions" \
  -H "Authorization: Bearer ${AOSENTRY_KEY}" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4o-mini",
    "messages": [
      {"role": "system", "content": "You are a concise assistant."},
      {"role": "user",   "content": "Say hello in one sentence."}
    ],
    "temperature": 0.2,
    "max_tokens": 64
  }'
