-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient.sh
More file actions
executable file
·49 lines (40 loc) · 1.2 KB
/
client.sh
File metadata and controls
executable file
·49 lines (40 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env bash
# Client examples — how to interact with a running satgate instance.
#
# Assumes satgate is running on localhost:3000 with a free tier enabled.
#
# Usage:
# chmod +x examples/client.sh
# ./examples/client.sh
set -euo pipefail
BASE_URL="${SATGATE_URL:-http://localhost:3000}"
echo "=== Discovery ==="
echo ""
echo "1. Check pricing and models (/.well-known/l402):"
curl -s "${BASE_URL}/.well-known/l402" | jq .
echo ""
echo "2. Machine-readable description (/llms.txt):"
curl -s "${BASE_URL}/llms.txt"
echo ""
echo "3. List available models (/v1/models):"
curl -s "${BASE_URL}/v1/models" | jq '.data[].id'
echo ""
echo "=== Inference ==="
echo ""
echo "4. Chat completion (within free tier):"
curl -s "${BASE_URL}/v1/chat/completions" \
-H "Content-Type: application/json" \
-d '{
"model": "llama3.2:1b",
"messages": [{"role": "user", "content": "What is Bitcoin in one sentence?"}]
}' | jq '.choices[0].message.content'
echo ""
echo "5. Streaming chat completion:"
curl -sN "${BASE_URL}/v1/chat/completions" \
-H "Content-Type: application/json" \
-d '{
"model": "llama3.2:1b",
"messages": [{"role": "user", "content": "Count to 5"}],
"stream": true
}'
echo ""