Files
exo/tmp/run_llm.sh
Evan Quiney 9815283a82 8000 -> 52415 (#915)
* 8000 -> 52415

* dont grab the api port for placement

---------

Co-authored-by: rltakashige <rl.takashige@gmail.com>
2025-12-18 18:39:44 +00:00

25 lines
621 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
if [ $# -lt 2 ]; then
echo "Usage: $0 <hostname> <query>"
exit 1
fi
HOST="$1"
shift
QUERY="$*"
curl -sN -X POST "http://$HOST:52415/v1/chat/completions" \
-H "Content-Type: application/json" \
-d "{
\"model\": \"mlx-community/Kimi-K2-Thinking\",
\"stream\": true,
\"messages\": [{ \"role\": \"user\", \"content\": \"$QUERY\"}]
}" |
grep --line-buffered '^data:' |
grep --line-buffered -v 'data: \[DONE\]' |
cut -d' ' -f2- |
jq -r --unbuffered '.choices[].delta.content // empty' |
awk '{ORS=""; print; fflush()} END {print "\n"}'