Files
Fabric/internal/plugins/template/Examples/openai-chat.sh
Kayvan Sylvan 0894ec28c1 chore: update model references to latest versions across docs and code
- Update default summarize model to `claude-sonnet-4-5`
- Replace `gpt-4o` references with `gpt-5.2` throughout docs
- Replace `gpt-4o-mini` references with `gpt-5-mini`
- Add MiniMax-M2.5 and M2.5-lightning to static models list
- Update image generation warning to suggest `gpt-5.2`
- Update OpenAI chat example script to use `gpt-5-mini`
- Update REST API docs and examples with current model names
2026-02-12 16:45:05 -08:00

21 lines
615 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
INPUT=$(jq -R -s '.' <<< "$*")
RESPONSE=$(curl "$OPENAI_API_BASE_URL/chat/completions" \
-s -w "\n%{http_code}" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d "{\"model\":\"gpt-5-mini\",\"messages\":[{\"role\":\"user\",\"content\":$INPUT}]}")
HTTP_CODE=$(echo "$RESPONSE" | tail -n1)
BODY=$(echo "$RESPONSE" | sed '$d')
if [[ "$HTTP_CODE" -ne 200 ]]; then
echo "Error: HTTP $HTTP_CODE" >&2
echo "$BODY" | jq -r '.error.message // "Unknown error"' >&2
exit 1
fi
echo "$BODY" | jq -r '.choices[0].message.content'